Results 1 to 6 of 6

Thread: custom php.ini doesn't apply for subdirectories??

  1. #1
    Member carock's Avatar
    Join Date
    Sep 2002
    Location
    St. Charles, MO
    Posts
    218

    Default custom php.ini doesn't apply for subdirectories??

    I had a customer create a php.ini file in their public_html. The phpinfo verifies this is the file loading.

    They have some php code in a subdirectory public_html/library/somefile.php

    Running the phpinfo page from the subdirectory shows the system global php.ini file, and not the one from public_html.

    Is this normal to have to replicate the php.ini file to all subdirectories within public_html too?

    Thanks,
    Chuck

  2. #2
    Member
    Join Date
    Sep 2004
    Location
    inside a catfish
    Posts
    1,100
    cPanel/WHM Access Level

    Root Administrator

    Default Re: custom php.ini doesn't apply for subdirectories??

    If you're running suPHP, then yes. Because you can't set various PHP directives .htaccess when running suPHP, you have to use a php.ini -- and it must be in any directory where there is code that is relying upon the particular modiications you are making to php.ini. php.ini is not recursive.

    Mike

  3. #3
    Member
    Join Date
    Aug 2010
    Location
    /proc
    Posts
    346
    cPanel/WHM Access Level

    Root Administrator

    Default Re: custom php.ini doesn't apply for subdirectories??

    Hello,

    There is a way to set php.ini per account in SuPHP. Please have a look at Some techie thoughts » Custom php.ini in cpaenl – SuPHP

    Thank you.

  4. #4
    Member
    Join Date
    Apr 2012
    Posts
    5
    cPanel/WHM Access Level

    Root Administrator

    Default Re: custom php.ini doesn't apply for subdirectories??

    If you have suPHP enabled on your server, then just add the following code in your .htaccess file (which is under public_html folder)

    SetEnv PHPRC /home/username/public_html (path of php.ini file)

    once set restart httpd and the settings will get apply to all the subsequent folders.

  5. #5
    Member
    Join Date
    May 2012
    Location
    India
    Posts
    96
    cPanel/WHM Access Level

    Root Administrator

    Default Re: custom php.ini doesn't apply for subdirectories??

    Quote Originally Posted by sopya View Post
    If you have suPHP enabled on your server, then just add the following code in your .htaccess file (which is under public_html folder)

    SetEnv PHPRC /home/username/public_html (path of php.ini file)

    once set restart httpd and the settings will get apply to all the subsequent folders.
    Spot On.. Absolutely correct. It's just that you don't need to restart apache

  6. #6
    Member
    Join Date
    Jul 2012
    Posts
    6
    cPanel/WHM Access Level

    Root Administrator

    Default Re: custom php.ini doesn't apply for subdirectories??

    Hi,

    You need to add the following in your .htaccess file if PHP is configured as suPHP in the server.

    =======
    suPHP_ConfigPath /home/cpaneluser/public_html ( the path in which custom php.ini is placed )
    =======

    If not the above one is given in .htaccess file, custom php.ini would be effective only to files in directory where php.ini is placed and should not apply to files in sub-folders.

Similar Threads

  1. php-fcgid+eaccelerator+custom php.ini+apache2-mpm-worker= segfault?
    By internetfab in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 01-30-2011, 04:25 PM
  2. php.ini works in webroot but no subdirectories
    By section31 in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 03-07-2009, 04:50 PM
  3. custom php.ini with php handler set as cgi
    By johny_gjx in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 02-16-2009, 03:54 AM
  4. php.ini command to copy to all subdirectories?
    By jenlepp in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 12-05-2006, 09:16 AM
  5. php 5.1.(1) and clients php.ini doesn't work
    By Rubas in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 12-14-2005, 11:16 AM