0

I have a custom php.ini file I created in my public_html directory. It works as I have checked the settings set are correct using phpinfo().

But the strange problem is the php.ini settings do not seem to apply to all sub_folders in the public_html directory?

Any ideas perhaps theres a setting needed in php.ini to apply to all subdirectories in public_html?

I found the answer myself you have to add the line into .htaccess file so it uses the custom php.ini file you created in public_html instead of having to copy php.ini file in every subdirectory you create.

Add this to .htaccess does the trick obviously replacing username

SetEnv PHPRC /home/USERNAME/public_html/php.ini
2
  • 2
    perhaps you use for your new site a framework that sets errors=on? Commented Aug 3, 2011 at 14:37
  • Well I just copied my new index.php as the new hompage and the errors do not show so the script appears to be right? But when I revert back to my old homepage and type url of that new homepage file the errors appear to screen again? Commented Aug 3, 2011 at 14:42

1 Answer 1

1

Not really a solution, but you can disable overriding the display_error setting by using php_admin_flag in your sites configuration. If it still happens then, you have set an error handler which misbehaves.

Sign up to request clarification or add additional context in comments.

3 Comments

Question changed. I noticed settings do work on pages inside public_html linked or unlinked. However does not apply to pages in directories in public_html ? Even on the live site the errors display in directories after public_html?
Settings are recursive, so if this is the case, either apache/vhost config does some overriding, or .htaccess files, but the latter cannot override a php_admin_flag, so one of the previous ones.
SetEnv PHPRC /home/USERNAME/public_html/php.ini added to .htacess does the trick for subdirectories

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.