简体   繁体   English

将应用程序上载到共享主机后,Symfony2会抛出ContextErrorException

[英]Symfony2 throws ContextErrorException after uploading the application to shared host

I have so much problems with deploying Symfony2 project to server, with searching and help of some links like Steps to move Symfony 2 project to hosting I finally did something! 我将Symfony2项目部署到服务器有很多问题,搜索和帮助一些链接,如将Symfony 2项目移动到托管的步骤,我终于做了一些事情! the problem is when I go to mydomain.com/web/app.php it shows blank page! 问题是当我去mydomain.com/web/app.php它显示空白页面! and when I go to mydomain.com/web/app_dev.php it throws this exception: 当我转到mydomain.com/web/app_dev.php时,会抛出此异常:

ContextErrorException: Warning: is_file(): open_basedir restriction in effect. ContextErrorException:警告:is_file():open_basedir限制生效。 File(/var/www/Symfony/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php) is not within the allowed path(s): (/var/www/vhosts/mydomain.com/httpdocs/:/tmp/) in /var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php line 80 文件(/var/www/Symfony/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php)不在允许的路径中:(/ var / www / vhosts / mydomain.com / httpdocs /:/ tmp /)在/var/www/vhosts/mydomain.com/httpdocs/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php第80行

The project works completely right on my local machine. 该项目完全适用于我的本地计算机。 Please help me with some advice, thanks. 请帮我一些建议,谢谢。

Check your open_basedir setting in your PHP configuration. 检查PHP配置中的open_basedir设置。 Turning it off should resolve your issue. 关闭它可以解决您的问题。

Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself. 将PHP可以访问的文件限制到指定的目录树,包括文件本身。 This directive is NOT affected by whether Safe Mode is turned On or Off. 此指令不受安全模式是打开还是关闭的影响。

When a script tries to access the filesystem, for example using include, or fopen(), the location of the file is checked. 当脚本尝试访问文件系统时,例如使用include或fopen(),将检查文件的位置。 When the file is outside the specified directory-tree, PHP will refuse to access it. 当文件在指定的目录树之外时,PHP将拒绝访问它。 All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink. 所有符号链接都已解析,因此使用符号链接无法避免此限制。 If the file doesn't exist then the symlink couldn't be resolved and the filename is compared to (a resolved) open_basedir . 如果该文件不存在,则无法解析符号链接,并将文件名与(已解析的)open_basedir进行比较。

try clearing the cache, in the shared host delete everything inside the 尝试清除缓存,在共享主机中删除内部的所有内容

app/cache

folder. 夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM