Symfony2 中的修复要求 [英] Fixing requirements in Symfony2

查看:32
本文介绍了Symfony2 中的修复要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的机器上安装了 Symfony2.

I've made a Symfony2 installation on my machine.

当我查看本地 url 中的要求时:

When I check the requirements in my local url:

localhost/Symfony2/web/config.php

它说:

主要问题

在 php.ini* 中设置date.timezone"设置(如欧洲/巴黎).

Set the "date.timezone" setting in php.ini* (like Europe/Paris).

建议

在 php.ini* 中将 short_open_tag 设置为 off.

Set short_open_tag to off in php.ini*.

将 magic_quotes_gpc 设置为 off inphp.ini*.

Set magic_quotes_gpc to off in php.ini*.

  • 必须在/etc/php5/apache2/php.ini"中更改 php.ini 文件.

我已经在 /etc/php5/apache2/php.ini/etc/php5/cli/php.ini 中进行了必要的更改:

I've made the required changes both in /etc/php5/apache2/php.ini and in /etc/php5/cli/php.ini:

date.timezone = "欧洲/马德里"

date.timezone = "Europe/Madrid"

short_open_tag = 关闭

short_open_tag = Off

magic_quotes_gpc = 关闭

magic_quotes_gpc = Off

当我检查 php.ini 文件时,short_open_tagmagic_quotes_gpc 都已设置为关闭.

Both short_open_tag and magic_quotes_gpc where already set to Off when I checked the php.ini files.

之后我重新启动了apache2:

After that I've restarted apache2:

sudo service apache2 restart

但是我仍然收到相同的错误消息.

However I still get the same error messages.

我使用 Symfony 2.1.2、Ubuntu 12.04 和 PHP 5.3.6

I use Symfony 2.1.2, Ubuntu 12.04 and PHP 5.3.6

更新:

如果我从浏览器运行 phpinfo(),它会显示它所在的加载的配置文件:

If I run phpinfo() from the browser, it says the Loaded Configuration File it's located in:

/etc/php5/apache2/php.ini

如果我运行 php -i |grep 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.

我已确保更改已保存在文件中.我还在一个 php 文件中使用了 phpinfo() 并在浏览器中执行了它.它说 date.timezone 的值没有设置,magic_quotes_gc 和 short_open_tag 设置为 On.

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.

如果我执行 php app/check.php,需求就解决了,所以我想 /etc/php5/cli/php.ini 它工作正常并且/etc/php5/apache2/php.ini 只有一个问题,它是与浏览器一起工作的.

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.

推荐答案

如果正确完成,您所做的更改应该可以解决您的问题;仔细检查一下.确保实际保存了更改.很多时候,当我在 Ubuntu 中编辑 php.ini 文件时,我忘记以正确的权限(root)运行编辑器,而错过了无法保存文件的警告.此外,通过从脚本调用 phpinfo() 来验证更改.

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.

当您从终端运行位于 app/check.php 中的脚本时,您是否得到相同的结果.从项目根目录:

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

如果仍然有问题,我只能建议清除缓存;使用 symfony2 可以解决很多问题.

If still having problem, all I can suggest is clearing the cache; with symfony2 a lot of problems are solved that way.

这篇关于Symfony2 中的修复要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆