As a learning exercise I used Symfony to update an existing application for a local non-profit. Development was in a Windows environment. Now that the application has been installed on their ISP's shared host I start to learn about chroot on a FastCGI server. There are errors such as this:
作为一项学习练习,我使用Symfony更新当地非营利组织的现有应用程序。开发是在Windows环境中进行的。现在应用程序已安装在其ISP的共享主机上,我开始了解FastCGI服务器上的chroot。有这样的错误:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/projectmana/www2.projectmana.org/app/logs/prod.log" could not be opened: failed to open stream: No such file or directory' in /www2.projectmana.org/app/cache/prod/classes.php:4823
PHP致命错误:未捕获异常'UnexpectedValueException',消息'流或文件“/home/projectmana/www2.projectmana.org/app/logs/prod.log”无法打开:无法打开流:没有此类文件或目录'在/www2.projectmana.org/app/cache/prod/classes.php:4823
The ISP responds with:
ISP回应:
Bad path. PHP is chrooted in /home/projectmana/.
糟糕的道路。 PHP在/ home / projectmana /中被chroot。
OK. I get it that this is the problem. Web searches so far have not provided a clue as to how to proceed. (I've gained greater appreciation for Symfony wanting to avoid shared hosting.) Is there a solution that I, a relative novice and a volunteer, can implement in my code, or does the application have to find a new home?
好。我明白这就是问题所在。到目前为止,网络搜索还没有提供关于如何进行的线索。 (我对Symfony希望避免共享托管感到非常感激。)我是一个相对新手和志愿者可以在我的代码中实现的解决方案,还是应用程序必须找到新家?
2 个解决方案
#1
0
You've got to set the doc_root
variable according to your chrooted directory:
您必须根据chrooted目录设置doc_root变量:
doc_root = "/home/projectmana"
cgi.fix_pathinfo = 0
You do this in the php.ini file - which seems to be not an option for you since you're on a shared server environment. When using Apache as a webserver, you can use a .htaccess
file and set the proper PHP directives there via php_value
.
您可以在php.ini文件中执行此操作 - 由于您处于共享服务器环境中,因此这似乎不适合您。当使用Apache作为Web服务器时,您可以使用.htaccess文件并通过php_value在那里设置正确的PHP指令。
#2
0
The solution in this instance was to override the locations of the cache and logs directories according to the cookbook. This, however, by itself causes the cache:clear
command to fail. The answer to that problem will have to appear in another question if I can't find it on my own.
此实例中的解决方案是根据cookbook覆盖缓存的位置并记录目录。但是,这本身会导致cache:clear命令失败。如果我自己找不到问题,那么问题的答案就必须出现在另一个问题中。
Update
The other solution here cannot work because any php setting in .htaccess when Apache server is running FastCGI will cause a server error. Clearing the cache was never solved so the site was moved to a non-CGI host.
这里的另一个解决方案无法正常工作,因为当Apache服务器运行FastCGI时,.htaccess中的任何php设置都会导致服务器错误。清除缓存从未解决,因此网站被移动到非CGI主机。
#1
0
You've got to set the doc_root
variable according to your chrooted directory:
您必须根据chrooted目录设置doc_root变量:
doc_root = "/home/projectmana"
cgi.fix_pathinfo = 0
You do this in the php.ini file - which seems to be not an option for you since you're on a shared server environment. When using Apache as a webserver, you can use a .htaccess
file and set the proper PHP directives there via php_value
.
您可以在php.ini文件中执行此操作 - 由于您处于共享服务器环境中,因此这似乎不适合您。当使用Apache作为Web服务器时,您可以使用.htaccess文件并通过php_value在那里设置正确的PHP指令。
#2
0
The solution in this instance was to override the locations of the cache and logs directories according to the cookbook. This, however, by itself causes the cache:clear
command to fail. The answer to that problem will have to appear in another question if I can't find it on my own.
此实例中的解决方案是根据cookbook覆盖缓存的位置并记录目录。但是,这本身会导致cache:clear命令失败。如果我自己找不到问题,那么问题的答案就必须出现在另一个问题中。
Update
The other solution here cannot work because any php setting in .htaccess when Apache server is running FastCGI will cause a server error. Clearing the cache was never solved so the site was moved to a non-CGI host.
这里的另一个解决方案无法正常工作,因为当Apache服务器运行FastCGI时,.htaccess中的任何php设置都会导致服务器错误。清除缓存从未解决,因此网站被移动到非CGI主机。