{"id":13771008,"url":"https://github.com/codeandcreate/JAGS-PHP","last_synced_at":"2025-05-11T03:32:59.154Z","repository":{"id":215828977,"uuid":"341326637","full_name":"codeandcreate/JAGS-PHP","owner":"codeandcreate","description":"Jet Another Gemini Server (for PHP) - mirrored","archived":false,"fork":false,"pushed_at":"2022-02-04T17:04:53.000Z","size":45,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-17T06:40:32.331Z","etag":null,"topics":["gemini-server","geminispace","php"],"latest_commit_sha":null,"homepage":"https://codeberg.org/codeandcreate/JAGS-PHP","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeandcreate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-02-22T20:21:42.000Z","updated_at":"2023-07-09T14:37:39.000Z","dependencies_parsed_at":"2024-01-07T21:55:13.846Z","dependency_job_id":null,"html_url":"https://github.com/codeandcreate/JAGS-PHP","commit_stats":null,"previous_names":["codeandcreate/jags-php"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandcreate%2FJAGS-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandcreate%2FJAGS-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandcreate%2FJAGS-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeandcreate%2FJAGS-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeandcreate","download_url":"https://codeload.github.com/codeandcreate/JAGS-PHP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514352,"owners_count":21920327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gemini-server","geminispace","php"],"created_at":"2024-08-03T17:00:46.363Z","updated_at":"2025-05-11T03:32:58.856Z","avatar_url":"https://github.com/codeandcreate.png","language":"PHP","funding_links":[],"categories":["Servers"],"sub_categories":["Graphical"],"readme":"# Jet Another Gemini Server (for PHP)\n\nA simple easy to understand and extendable single PHP-Class socket server written in PHP.\n\nJAGS is based of Gemini-PHP by @neil@glasgow.social (Matrix). You can read more about it at gemini://glasgow.social/gemini-php\n\n## History\n| Date | Version | Changes |\n|---|---|---|\n| 2022-02-04 | 202202_3 | default files for subdirectories, more than one default file |\n| 2022-02-04 | 202202_2 | security fix |\n| 2022-02-03 | 202202_1 | Multiple (sub) domains |\n| 2021-09-11 | 202109_1 | fixed bug for serving files that are bigger than ~100kb |\n| 2021-04-28 | 202104_1 | bugfix for high cpu load |\n| 2021-02-25 | 202102_4 | bugfix for path params, try/catch for external php scripts, better get params translation, better logging |\n| 2021-02-23 | 202102_2 | log cleanup added, more documentation |\n| 2021-02-22 | 202102_1 | first release|\n\n## Quickstart\n\n1. git clone this repository (or download a zipped snapshot)\n2. create a new ssl certificate for your host with ```openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes```\n3. concet the key and cert to one file with ```cp cert.pem certs/yourdomain.com.pem; cat key.pem \u003e\u003e certs/yourdomain.com.pem```\n4. copy ```config.sample.php``` to ```config.php```\n5. configure your hosts in line 49 \n6. run the server with ```php server.php```\n\nFor more details look at the comments in ```config.sample.php```, ```server.php``` and the files in the hosts/default directory.\n\n## Upgrade from 202109_1\n\n- Check the changes in the config.sample.php. With the new hosts-Array you need to reconfigure your server\n- If you use a certificate with pass phrase you must replace it with one certificate without password.\n\n## Dynamic pages with PHP\n\nThe server looks for PHP scripts and runs them with ```include```. All your scripts ```echo``` (...) will returned to the client as ```text/gemini``` mime type.\n\nIf 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:\n\n```\n[\n\t'host'\t\t=\u003e '...',\n\t'scheme' \t=\u003e 'gemini',\n\t'path'\t\t=\u003e '/dynamic.php',\n\t'query'\t\t=\u003e '...',\n\t'get' \t\t=\u003e [],\n\t'auth' \t\t=\u003e false,\n\t'file_path'\t=\u003e '...',\n]\n```\n\nIt'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.\n\nTo manipulate the return data check the ```$JAGSReturn``` array:\n\n```\n[\n\t'content' \t=\u003e false,\n\t'status_code'\t=\u003e '20',\n\t'meta' \t\t=\u003e 'text/gemini',\n\t'file_size' \t=\u003e 0,\n]\n```\n\n```file_size``` will be automatically calculated based on ```content```, which will be filled with all stuff you ```echo``` in your PHP script.\n\nIf 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:\n\n```\n[\n\t//...\n\t'path'\t\t=\u003e '/dynamic.php',\n\t'query'\t\t=\u003e 'param3=test\u0026myparam1\u0026myparam2=2',\n\t'get' \t\t=\u003e [\n\t\t'param3'\t=\u003e 'test',\n\t\t1 \t\t=\u003e 'myparam1',\n\t\t'myparam2'\t=\u003e '2',\n\t],\n\t//...\n]\n```\n\nNotice: \"myparam1\" will be added as indexed param.\n\n## What is Gemini?\n\n[Excerpt from gemini.circumlunar.space](https://gemini.circumlunar.space/docs/specification.html):\n\n\u003e Gemini is a client-server protocol featuring request-response transactions, broadly similar to gopher or HTTP. Connections are closed at the end of a single transaction and cannot be reused. When Gemini is served over TCP/IP, servers should listen on port 1965 (the first manned Gemini mission, Gemini 3, flew in March'65). This is an unprivileged port, so it's very easy to run a server as a \"nobody\" user, even if e.g. the server is written in Go and so can't drop privileges in the traditional fashion.\n\nMore about Gemini protocol, tools, servers, clients you can find at the [Awesome Gemini](https://github.com/kr1sp1n/awesome-gemini) repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeandcreate%2FJAGS-PHP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeandcreate%2FJAGS-PHP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeandcreate%2FJAGS-PHP/lists"}