问题
I've made a Symfony2 installation on my machine.
When I check the requirements in my local url:
localhost/Symfony2/web/config.php
It says:
MAJOR PROBLEMS
Set the "date.timezone" setting in php.ini* (like Europe/Paris).
RECOMMENDATIONS
Set short_open_tag to off in php.ini*.
Set magic_quotes_gpc to off in php.ini*.
- Changes to the php.ini file must be done in "/etc/php5/apache2/php.ini".
I've made the required changes both in /etc/php5/apache2/php.ini
and in /etc/php5/cli/php.ini
:
date.timezone = "Europe/Madrid"
short_open_tag = Off
magic_quotes_gpc = Off
Both short_open_tag
and magic_quotes_gpc
where already set to Off when I checked the php.ini files.
After that I've restarted apache2:
sudo service apache2 restart
However I still get the same error messages.
I use Symfony 2.1.2, Ubuntu 12.04 and PHP 5.3.6
UPDATE:
If I run phpinfo() from the browser, it says the Loaded Configuration File it's located in:
/etc/php5/apache2/php.ini
If I run php -i | grep php.ini
it says the Loaded Configuration File it's located in:
/etc/php5/cli/php.ini
These are the two files where I've already made the changes.
I've made sure that the changes have been saved in the file. I also have used phpinfo() in a php file and executed it in the browser. It says that the values for date.timezone are not set, and magic_quotes_gc and short_open_tag are set to On.
If I execute php app/check.php
, the requirements are resolved, so I suppose that /etc/php5/cli/php.ini
it's working correctly and there is only a problem with /etc/php5/apache2/php.ini
, which is the one that works with the browser.
回答1:
The changes you have made should fix your problem if done correctly; double check that. Make sure the changes are actually being saved. Many times when I edit php.ini files in Ubuntu I forget to run the editor with the right permissions(root) and miss the warning that the file could not be saved. Also, verify the changes by calling phpinfo() from a script.
Do you get the the same result when you run the scrip located in app/check.php from the terminal. From project root:
php app/check.php
If still having problem, all I can suggest is clearing the cache; with symfony2 a lot of problems are solved that way.
回答2:
Be sure to remove the comment semi colon from the beginning of the string also from /etc/php5/cli/php.ini
From :
;date.timezone = "America/Vancouver"
To:
date.timezone = "America/Vancouver"
回答3:
I too had to set the date.timezone variable in response to the same error message. The error message was finally resolved by clearing the cache as below by running:
php app/console cache:clear
回答4:
Do you editing correct ini file ? I'm edit /etc/php5/cli/php.ini and that resolve problem for me
来源:https://stackoverflow.com/questions/12999221/fixing-requirements-in-symfony2