简体   繁体   中英

custom php.ini for domain

I have global php.ini file located in /usr/local/lib folder. The custom php.ini file is in /home/petstail/public_html/ folder.

This is how my phpinfo() look like.

在此处输入图片说明

I am still loading global php.ini file. How to change configuration file path, and run custom php.ini file.

Thanks.

You might be able to do it via .htaccess by setting an environment variable (if Apache is running mod_php):

SetEnv PHPRC /home/petstail/public_html/php.ini

However, your php.ini file should not be in the document root (where it's publicly accessible) ... at the very least store it in a directory protected with another .htaccess defining Deny from all .

OR you could deny access to php.ini using the following.

<FilesMatch "php.ini">
    deny from all
    allow from 127.0.0.1
<FilesMatch>

Depending on your php version you should refer the the php documentation to see if INI settings are on.

See here: http://www.php.net/manual/en/configuration.file.per-user.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM