使用PHP-FPM时,我可以覆盖htaccess中的PHP设置吗?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使用PHP-FPM时,我可以覆盖htaccess中的PHP设置吗?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1691字,纯文字阅读大概需要3分钟。
内容图文
![使用PHP-FPM时,我可以覆盖htaccess中的PHP设置吗?](/upload/InfoBanner/zyjiaocheng/696/14a8aff3f80043c18c31581189e5d135.jpg)
我的vhost看起来像这样:
<Directory "/var/www">
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Require all granted
<FilesMatch "\.php$">
Require all granted
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
</Directory>
我正在尝试将php_value行添加到我的.htaccess文件中.在我这样做的时候,我得到500个错误,这在我的Apache的错误日志中:
/var/www/.htaccess: Invalid command ‘php_value’, perhaps misspelled or
defined by a module not included in the server configuration
所以,问题是:当使用PHP-FPM时,有没有办法通过.htaccess覆盖php.ini设置?
TIA.
解决方法:
正如其他人已经指出的那样,不能,在使用PHP-FPM时,不能通过.htaccess覆盖设置.
但似乎有一种类似PHP的机制,名为.user.ini文件.
Since PHP 5.3.0, PHP includes support for configuration INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.
In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER[‘DOCUMENT_ROOT’]). In case the PHP file is outside the document root, only its directory is scanned.
Only INI settings with the modes PHP_INI_PERDIR and PHP_INI_USER will be recognized in .user.ini-style INI files.
并在下面的评论中
“If you are using Apache, use .htaccess files for the same effect.”
To clarify, this applies only to Apache module mode. If you put php directives in .htaccess on an Apache CGI/FastCGI server, this will bomb the server out with a 500 error.
因此,您可以创建类似于.htaccess的.user.ini文件,但采用的是ini样式格式.
内容总结
以上是互联网集市为您收集整理的使用PHP-FPM时,我可以覆盖htaccess中的PHP设置吗?全部内容,希望文章能够帮你解决使用PHP-FPM时,我可以覆盖htaccess中的PHP设置吗?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。