Which php.ini file uses symfony server: execute command?

I use virtphp to create separate environments (different versions of PHP, extensions, etc.).

When I use the symfony command to start the local development server:

php app/console server:run 

It seems to be ignoring the php.ini file of my virtual environment (~ / .virtenv / envs / myenv / etc / php.ini), for example: it does not load the extensions defined in this file.

But when I use the built-in php server directly , it works fine:

 php -S 127.0.0.1:8000 --docroot=web/ 

What is the difference between the two commands or what makes symfony different?

This is the output of the php --ini :

 Configuration File (php.ini) Path: /usr/local/etc/php/5.5 Loaded Configuration File: /Users/mjuarez/.virtphp/envs/wowfi/etc/php.ini Scan for additional .ini files in: /Users/mjuarez/.virtphp/envs/wowfi/etc/php Additional .ini files parsed: (none) 

This is the result of the phpinfo() function in the Symfony controller when using the php app/console server:run command:

 Configuration File (php.ini) Path /usr/local/etc/php/5.5 Loaded Configuration File /usr/local/etc/php/5.5/php.ini Scan this dir for additional .ini files /Users/mjuarez/.virtphp/envs/wowfi/etc/php Additional .ini files parsed (none) 

Note the difference in the “Loaded configuration file” ... when I use the php --ini , it replaces the “Loaded configuration file” with the one in my php virtual environment, and when I use the php app/console server:run command php app/console server:run , it uses the "global" configuration file.

+7
source share
3 answers

A workaround for this problem is to move the php.ini file of my virtual environment to the php subdirectory inside the etc. directory. eg:.

Move the file ~/.virtphp/envs/my-env/etc/php.ini

To ~/.virtphp/envs/my-env/etc/php/php.ini

0
source

For the record (and for all the lost souls who come here using a google search like me):

The Symfony console is not a program in itself. This is just a PHP script. Therefore, when you start the Symfony console, it does not have its own php.ini or extension directory or other configuration - it uses the same settings as all your other PHP scripts. (If not overwritten at run time - which may actually be the case in the original question.)

0
source

Drop the file into your web directory inside. Open it in your browser and find php.ini which will give you the correct file. There may be several files if you look at the directive in your configuration directory (cli, fpm, apache, etc.)

-1
source

All Articles