A simple easy to understand and extendable single PHP-Class socket server written in PHP.
JAGS is based of Gemini-PHP by @neil:glasgow.social (Matrix). You can read more about it at:
=> gemini://glasgow.social/gemini-php
Date Version Changes 2022-04-21 202204_1 support for file handlers 2022-02-04 202202_3 default files for subdirectories, more than one default file 2022-02-04 202202_2 security fix 2022-02-03 202202_1 Multiple (sub) domains 2021-09-11 202109_1 fixed bug for serving files that are bigger than ~100kb 2021-04-28 202104_1 bugfix for high cpu load 2021-02-25 202102_4 bugfix for path params, try/catch for external php scripts, better get params translation, better logging 2021-02-23 202102_2 log cleanup added, more documentation 2021-02-22 202102_1 first release
For more details look at the comments in config.sample.php, server.php and the files in the hosts/default directory.
The server looks for PHP scripts and runs them with include. All your scripts echo (...) will returned to the client as text/gemini mime type.
If you want to check the request data, for example for get params or auth informations you can do this with the $JAGSRequest array inside your script:
[ 'host' => '...', 'scheme' => 'gemini', 'path' => '/dynamic.php', 'query' => '...', 'get' => [], 'auth' => false, 'file_path' => '...', ]
It's the result of parse_url() with a extra array for get-params, auth informations by openssl_x509_parse() and the absolute path to the current file.
To manipulate the return data check the $JAGSReturn array:
[ 'content' => false, 'status_code' => '20', 'meta' => 'text/gemini', 'file_size' => 0, ]
file_size will be automatically calculated based on content, which will be filled with all stuff you echo in your PHP script.
If you want virtual paths you could just place a PHP named for example dynamic.php and open /dynamic/myparam1/myparam2=2?param3=test in your Gemini browser. The result in $JAGREQUEST is following:
[ //... 'path' => '/dynamic.php', 'query' => 'param3=test&myparam1&myparam2=2', 'get' => [ 'param3' => 'test', 1 => 'myparam1', 'myparam2' => '2', ], //... ]
Notice: "myparam1" will be added as indexed param.
=> Download (202204_1) | codeberg Repository
You have found a bug or have questions? Contact me on Matrix: @scops:tchncs.de
text/gemini
This content has been proxied by September (3851b).