设置 php.ini 的路径 [英] Set path to php.ini

查看:36
本文介绍了设置 php.ini 的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能只有一个 php.ini 文件,例如在 webroot 中(或者甚至在它之外以防止人们通过 GET 访问它),并快速轻松地告诉 PHP 它在哪里?

Is it possible to have just a single php.ini file, for example in the webroot (or even outside of it to prevent people accessing it via GET), and tell PHP quickly and easily where it is?

我知道您可以在 .htaccess 中设置 php.ini 指令,但是是否可以定义要使用的特定 php.ini 文件?

I know you can set php.ini directives in .htaccess, but is it possible to define a specific php.ini file to be used?

推荐答案

将此添加到您的服务器配置...

Add this to your server configuration...

<VirtualHost 1.2.3.4:80>
PHPINIDir /path/to/new/php_ini
</VirtualHost>

确保只包含目录的路径,而不是文件的整个路径.

Make sure to just include the path to the directory, not the entire path to the file.

然后重启Apache.

Then restart Apache.

检查它是否与 phpinfo() 一起工作.

Check it worked with phpinfo().

这篇关于设置 php.ini 的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆