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

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

问题描述

时有可能有只是一个单一的php.ini文件,例如在Web根目录(甚至是外面的它prevent人通过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()

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

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