.htaccess中的php include未设置


php include in .htaccess not getting set

我正在尝试在htaccess文件中设置php的包含路径。它在我的本地计算机上工作,但在我的开发服务器上不工作。两个ubuntun都在运行apache2.2这是我的.htaccess文件:

AddType application/x-httpd-php .html .htm .php
# ---------------------------------------------------------------------------
# PHP.INI VALUES
# Upload Variables, Include Path, Etc
# ---------------------------------------------------------------------------
php_value include_path "/var/www/includes:.:/usr/local/lib/php:/var/www/"
php_value upload_max_filesize 5242880
php_value post_max_size 5242880
php_value memory_limit 32M
# ---------------------------------------------------------------------------
# Prepend File
# ---------------------------------------------------------------------------
php_value auto_prepend_file "/var/www/includes/prepend.php"
    <Limit GET POST>
    order deny,allow
    deny from all
 allow from all
</Limit>
<Limit PUT DELETE>
        order deny,allow
    deny from all
</Limit>

我不明白为什么这不起作用。有什么想法吗?

apache错误显示:PHP致命错误:requireonce():无法在第3行的/var/www/concert2.PHP中打开所需的"db.inc.PHP"(include_start='.:/usr/share/PHP:/usr/share/pear')

检查:

  • 您的目录结构完全相同
  • Apache有读取此文件的权限
  • 代码中的路径。确保没有打字错误等

这篇相关文章可能会有所帮助:PHP致命错误打开所需文件失败

根据我的经验,这些问题几乎总是与路径有关(你实际上并没有指向你认为指向的地方)或与权限有关。