我想将PHP包含路径设置为另一个目录。我试图把它放在一个.htaccess文件中,但没有奏效。我唯一看到的是我在httpd.conf中设置的包含路径,但不是我尝试添加的路径。如何通过.htaccess设置PHP包含路径?
<IfModule mod_php5.c>
php_value include_path ".:/var/www/mywebsite/"
</IfModule>
我在做什么错? 我做过a2enmod mod_php5
,但它已经在运行,所以我想PHP5已经作为Apache模块运行了。
[编辑]在我的虚拟主机的配置我有这样的:
<Directory ~ "^/var/www/.*">
AllowOverride All
Options FollowSymLinks -Indexes -MultiViews
php_value include_path ".:./include:./.include/:/var/www/.include/:/var/www/"
</Directory>
更多信息(phpinfo()
):
Loaded Modules core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_auth_mysql mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_status
include_path .:./include:./.include/:/var/www/.include/:/var/www/ .:/usr/share/php:/usr/share/pear
问候, 凯文
如果你使用它作为一个PHP模块它应该工作。仔细检查你必须安装mod_php5.c模块并仔细检查路径。 'phpinfo()'是你的朋友。 – hakre
谢谢,我会很快发布我的'phpinfo()';)。 –
稍微偏离主题,但如果你有共同的配置文件,你可以使用['set_include_path()'](http://www.php.net/set_include_path)在运行时修改'include_path'。 – binaryLV