Jonathan
Jonathan

Reputation: 19119

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?

Upvotes: 8

Views: 4589

Answers (1)

Jonathan
Jonathan

Reputation: 19119

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

Upvotes: 18

Related Questions