Just very quick question about php.ini file. I created my own on my php.ini file and it works fine if I put it inside my 'public_html' directory. However the problem is it can obviously be viewed in browser through HTTP requests.
So, I am trying to move it outside my 'public_html' directory however it does not seem to work when outside my 'public_html'.
I know I could perhaps set in my .htaccess the following to avoid it being read:
<Files php.ini>
Order allow,deny
Deny from all
</Files>
However I do not want to do this as my php.ini can sti开发者_运维问答ll get cached by Google if it's in the 'public_html' directory. Is there any suggestions to make it work outside my public_html?
I am running an Apache server. Thanks for any suggestions
You can use the PHPRC
environment variable...see the documentation:
http://www.php.net/manual/en/configuration.file.php
It can't get cached by google if you block like that in .htaccess
Two suggestions:
- Ensure that Apache can find your php.ini (PHPINIDIR /path/where/php.ini/is/located)
- Ensure the file is readable by the webserver user.
How is it that you php.ini came to be in a web server accessible folder? It is the first time I hear of such a situation.
I thought hard on how you managed to do this, and the only answer I came up with is that you created a vhost in php folder. If that is the case, create another vhost out of the php.ini path, and remove the offending vhost. See this post for examples.
精彩评论