php 包含在 .htaccess 中未设置

发布于 2024-11-17 08:33:37 字数 1165 浏览 2 评论 0原文

我正在尝试在 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 致命错误:require_once(): 无法在线打开 /var/www/concert2.php 中所需的 'db.inc.php' (include_oath='.:/usr/share/php:/usr/share/pear') 3

I am trying to set the include path for php in my htaccess file. It works on my local computer but on my dev server it doesn't work. Both ubuntun running apache2.2 Here is my .htaccess file:

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>

I am lost as to why this isn't working. Any ideas?

The apache error is saying:
PHP Fatal error: require_once(): Failed opening required 'db.inc.php' (include_oath='.:/usr/share/php:/usr/share/pear') in /var/www/concert2.php on line 3

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北风几吹夏 2024-11-24 08:33:37

检查:

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

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

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

Check:

  • Your directory structure is the exact same
  • Apache has permissions to read this file
  • The path in your code. Make sure there's no typos, etc.

This related article might help:
PHP Fatal Error Failed opening required File

In my experience, these problems are almost always either path related (you're not actually pointing where you think you're pointing) or permissions related.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文