我有一个使用propel的网站。我希望将各种配置文件从web根目录中删除,但是propel需要它们(如schema.xml
、build.properties
等)位于同一个目录中。因此,我决定从web根目录中添加符号链接到以下目录:
somesite.com/
|
|- public/
| |- index.php
| |- build -> ../private/build
| |- vendor -> ../private/vendor
|
|- private/
| |- build.properties
| |- schema.xml
| |- build/
| |- vendor/
我的包含路径是这样设置的:
set_include_path('vendor/propel/propel1/runtime/lib' . PATH_SEPARATOR . 'build/classes' . PATH_SEPARATOR . get_include_path());
但是,当我尝试require_once 'Propel.php';
时,我会得到以下错误:
Warning: require_once(Propel.php): failed to open stream: No such file or directory in /home/staging/apache/somewebsite.co.uk/public/functions.php on line 5
使用chdir('vendor/propel/propel1/runtime/lib');
检查它,我得到以下错误:
Warning: chdir(): Permission denied (errno 13) in /home/staging/apache/somewebsite.co.uk/public/functions.php on line 5
因此,PHP/Apache似乎不会遵循符号链接。我尝试了以下几点:
o+x
,以便apache能够读取它。Options FollowSymLinks
添加到apache中的目录指令中(尽管在文档中它表示这是默认设置)chcon -R -h -t httpd_sys_content_t public/vendor/
更改SELinux类型,但由于某种原因它没有改变更新
我以apache (su -s /bin/bash apache
)的身份登录,并在public
目录中运行cat vendor/propel/propel1/runtime/lib/Propel.php
,它运行得很好。但是,我暂时禁用了SELinux和,错误消失了。所以,当然,它必须是SELinux。
正如我前面提到的,我试过:
chcon -R -h -t httpd_sys_content_t public/vendor/
但是在完成之后,运行ls -alZ
可以为供应商提供以下信息:
lrwxrwxrwx. staging developers unconfined_u:object_r:user_home_t:s0 vendor -> /home/staging/apache/somewebsite.co.uk/private/vendor/
有什么想法吗?
发布于 2014-04-29 13:16:57
问题最终是我试图设置SELinux类型的方式。
我当时在跑步:
chcon -R -h -t httpd_sys_content_t public/vendor/
然而,我不得不跑:
chcon -R -h -t httpd_sys_content_t public/vendor
不带,尾随斜杠。一旦我做了这件事,所有的事情都会立即出现在生活中。
注意:由于配置中没有Options
指令,所以不必指定它,而且它仍然有效。
https://stackoverflow.com/questions/23362186
复制相似问题