Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure the PHP built-in web server

While using the built-in PHP web server, how do you set configuration options, typically set using php.ini or a .htaccess file?

like image 964
Jonathan Avatar asked Jan 22 '14 15:01

Jonathan


1 Answers

Configuration file:

Simply add a custom configuration file to your project, and then run the built-in server with this flag:

php -S localhost:8000 -c php.ini

This is especially helpful for settings that cannot be set at runtime using ini_set().

Example php.ini file:

short_open_tag=On

Without a configuration file:

You can also forgo the php.ini file and add your configuration inline:

php -S localhost:8000 -c "short_open_tag=On" -t public/ server.php
like image 120
Jonathan Avatar answered Sep 20 '22 01:09

Jonathan