{"id":15308618,"url":"https://github.com/natanfelles/php-server","last_synced_at":"2025-04-15T01:05:15.650Z","repository":{"id":57024009,"uuid":"112020909","full_name":"natanfelles/php-server","owner":"natanfelles","description":"Fine-tuning on the PHP built-in web server","archived":false,"fork":false,"pushed_at":"2024-11-22T23:00:19.000Z","size":137,"stargazers_count":26,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T01:05:01.076Z","etag":null,"topics":["autoindex","document-root","mod-rewrite","php","php-dev","php-development","php-ini","php-server","php-webserver","rewrite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/natanfelles.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}},"created_at":"2017-11-25T17:12:43.000Z","updated_at":"2025-03-08T22:20:26.000Z","dependencies_parsed_at":"2022-08-23T13:50:52.443Z","dependency_job_id":null,"html_url":"https://github.com/natanfelles/php-server","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanfelles%2Fphp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanfelles%2Fphp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanfelles%2Fphp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/natanfelles%2Fphp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/natanfelles","download_url":"https://codeload.github.com/natanfelles/php-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986313,"owners_count":21194025,"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":["autoindex","document-root","mod-rewrite","php","php-dev","php-development","php-ini","php-server","php-webserver","rewrite"],"created_at":"2024-10-01T08:17:23.198Z","updated_at":"2025-04-15T01:05:15.620Z","avatar_url":"https://github.com/natanfelles.png","language":"PHP","readme":"# PHP Server\n\n[![Latest release](https://img.shields.io/github/release/natanfelles/php-server.svg?colorB=green\u0026label=Latest%20release\u0026style=popout)](https://github.com/natanfelles/php-server/releases)\n[![PHP version](https://img.shields.io/packagist/php-v/natanfelles/php-server.svg?colorB=blueviolet\u0026label=PHP%20version\u0026style=flat)](https://php.net/downloads.php)\n[![Packagist downloads](https://img.shields.io/packagist/dt/natanfelles/php-server.svg?colorB=%23f28d1a\u0026label=Packagist%20downloads\u0026style=flat)](https://packagist.org/packages/natanfelles/php-server)\n\nFine-tuning on the PHP built-in web server\n\n![PHP Built-in web server autoindex](https://i.imgur.com/dE7B2LJ.png)\n\n\u003e See release notes at: https://github.com/natanfelles/php-server/releases\n\n## Installation\n\n### Composer\n\nOpen your terminal and run:\n\n```sh\ncomposer global require natanfelles/php-server\n```\n\nAdd the composer bin path to your *.bashrc*:\n\n```sh\necho 'export PATH=\"$PATH:$HOME/.config/composer/vendor/bin\"' \u003e\u003e ~/.bashrc\n```\n\nRun:\n\n```sh\nsource ~/.bashrc\n```\n\n### Manual\n\nDownload and extract the *php-server* project folder.\n\nAdd the php-server alias to your *.bashrc*:\n\n```sh\necho 'alias php-server=\"~/php-server/bin/php-server\"' \u003e\u003e ~/.bashrc\n```\n\nRun:\n\n```sh\nsource ~/.bashrc\n```\n\n## Config\n\nYou can run the php-server in any folder of your operating system.\n\nEach time you run the *php-server* command, it will look up if there is a file named *php-server.ini* in the current directory. If found, your settings will override the default settings.\n\nA quick example file content is:\n\n```ini\nphp = PHP_BINARY\nhost = localhost\nport = 8080\nroot = ./public\nautoindex = true\nindex = index.php\nerror_reporting = E_ALL\n\n[ini]\ndisplay_errors = 1\ndisplay_startup_errors = 1\nmax_execution_time = 360\npost_max_size = 200M\nupload_max_filesize = 200M\n\n[server]\nENVIRONMENT = development\n```\n\n\u003e You can use the command `php-server new` to create a new configuration file in the current directory.\n\n### Explanation\n\n#### General Vars\n\n| Key | Default Value| Description |\n| --------------- | --- | --- |\n| php | [PHP_BINARY](http://php.net/manual/en/reserved.constants.php#constant.php-binary) | PHP binary path or command |\n| host | localhost | Server host |\n| port | 8080 | Server host port |\n| root | [getcwd()](http://php.net/manual/en/function.getcwd.php) | Document root. The location that will be the public root of your website. |\n| autoindex | true | Determines if the server will list directory contents if it does not find an index file. |\n| index | index.html index.php | The names of the index files separated by spaces. |\n| error_reporting | [E_ALL](http://php.net/manual/en/errorfunc.constants.php#errorfunc.constants.errorlevels.e-all) | Sets the [level of errors](http://php.net/manual/en/function.error-reporting.php) that will be reported. |\n\n#### Sections\n\n| Section | Description |\n| --- | --- |\n| ini |  Used to set custom [php.ini directives](http://php.net/manual/en/ini.list.php). |\n| server | Used to set custom [Server and execution environment information](http://php.net/manual/en/reserved.variables.server.php). |\n\nKnowing this, just create (if necessary) a php-server.ini file, run the server and you're done.\n\n## Run\n\nAs you can see in the [config](#config). You can create a php-server.ini file to leave the settings of each project already pre-established.\n\nBut, you can also simply run `php-server` and the server will already be available at [http://localhost:8080](http://localhost:8080).\n\nThe php-server command can receive some parameters and they are:\n\n| Parameter | Description |\n| --- | --- |\n| --php | PHP binary path or command  |\n| --host | Server host |\n| --port | Server host port |\n| --root | Document root |\n\nFor example, to run the server on a different port:\n\n```sh\nphp-server --port 8081\n```\n\nOr, also with a different version of PHP than the default:\n\n```sh\nphp-server --php php8.4 --port 8081\n```\n\nRight. You get the idea. If you want to run on a different host you can add the host to the [hosts file](https://en.wikipedia.org/wiki/Hosts_(file)) of your operating system.\n\n## Contribute\n\nHello, how nice that you are reading this.\n\nIf you have any idea to improve this project or something is not working as it should, do not hesitate to open an [issue](https://github.com/natanfelles/php-server/issues) and if you have solved the problem feel free to open a [Pull Request](https://github.com/natanfelles/php-server/pulls).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanfelles%2Fphp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatanfelles%2Fphp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatanfelles%2Fphp-server/lists"}