I'm using virtphp to have separate environments (different PHP versions, extensions, etc).
When I use symfony's command to run a local development server:
php app/console server:run
It seems that it ignores the php.ini file of my virtual environment (~/.virtenv/envs/myenv/etc/php.ini), e.g.: does not load the extensions definided in that file.
But when I use the php built-in server directly, it works perfectly:
php -S 127.0.0.1:8000 --docroot=web/
What's the difference of those two commands or what does symfony do differently?
This is the output of the php --ini
command:
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 output of the function phpinfo()
in a Symfony controller when using the command php app/console server:run
:
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 "Loaded Configuration File"... when I use the php --ini
command it replaces the "Loaded Configuration file" with the one in my php virtual environment and when I use the command php app/console server:run
it uses the "global" configuration file.
user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.
ini file: Whenever we install PHP, we can locate the configuration file inside the PHP folder. If using xampp, we can find the configuration file in one or many versions, inside the path '\xampp\php'. Note: Other versions of this file are php. ini-development and php.
The php. ini file contains all of the current PHP configuration settings: such as the execution time, memory limit, etc. This is also how PECL modules are enabled such as memcache, APC, etc. This file allows you to override the server's default configuration settings.
For the record (and for all lost souls who arrive here by Google search like me):
Symfony console is not a program per se. It is just a PHP script. Therefore, when you run Symfony console, it doesn't have its own php.ini or extension directory or other configuration - It uses the same settings as all your other PHP scripts. (Unless overwritten at runtime - which actually might be the case of the original question.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With