The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php-preferences only for a specific domain

Discussion in 'General Discussion' started by forquato, Aug 27, 2009.

  1. forquato

    forquato Active Member

    Joined:
    Aug 27, 2009
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    i would like to set some php-preferences. No Problem for all domains.
    But what is, when I would like to set some preferences only to a sepecific domain.

    I have to set preferences like

    Code:
    PHP max_execution_time: 	30 - Must be more than 120
    PHP memory_limit: 	32M - Must be more than 128M
    this is for awbs. But this is no good for other accounts or users.
    So what shall I do?
    Do You know, where are the files to change, or which php.ini shall I change.
    The best way for me would be to create a new php.ini for
    the specific domain. But how should it be done.


    Thank you.
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    How you set custom PHP options depends entirely upon how your PHP is setup ...

    For DSO based PHP (Apache Module) :
    Code:
       You can either put overrides in the virtualhost configuration in 
       /usr/local/apache/conf/httpd.conf or create a .htaccess file within the
       account with "php_flag" or "php_value" override commands.
    
       For some items you can use the ini_set() function but it is limited
    
    For phpSuExec based PHP (CGI):
    Code:
       You can create a custom PHP.INI file within the account folders
      where you want the php settings overrides containing the changed
      and updated settings that you want for that account.
    
    For SuPHP based PHP (DSO controlling CGI):
    Code:
      You will need to add a "suPHP_Config" command to the SuPHP section
       in the virtualhost container for the site in /usr/local/apache/conf/httpd.conf
       specifying the location where you would like to read a custom PHP.INI.
       (SuPHP does this to protect from users overriding their own settings)
    
       Once that is setup, the rest is pretty much identical to phpSuExec in that
       you need to create a custom PHP.INI except instead of just changed
       settings, you will want to make it a complete copy of the main system
       PHP.INI (/usr/local/lib/php.ini) that has the changes made that you want
       for the site and stored in the location you give in the suPHP_Config 
       command.
    
       For information about suPHP_Config, see the SuPHP documentation site.
    
    NOTE: You cannot use .htaccess overrides with phpSuExec OR SuPHP based PHP!
     
  3. forquato

    forquato Active Member

    Joined:
    Aug 27, 2009
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6

    phpsuexec is PHP with a fcgi-handle and apache with suexec?
     
  4. forquato

    forquato Active Member

    Joined:
    Aug 27, 2009
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6

    I use fcgid as PHP-Handle.
    I create a new php.ini in a direcory.
    But the settings are only used from the main php.ini.

    How can I set an own php.ini for a specific domain or subdomain?
     
  5. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    I recommend using SuPHP to allow for easy use of custom php.ini files for end-users. To make custom php.ini files work in FastCGI it requires additional customization; however, no extra work is required to use custom php.ini files in SuPHP.

    For more detailed comparisons and explanations, please also reference the following documentation that compares the PHP handlers:
    ApachePHPRequestHandling < EasyApache3 < TWiki
     
  6. forquato

    forquato Active Member

    Joined:
    Aug 27, 2009
    Messages:
    35
    Likes Received:
    0
    Trophy Points:
    6

    Okay, but I think some Scripts wont work with suphp. What settings should be set in order to make all php scripts work wih suphp?
     
  7. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    There is no "one size fits all" set of php.ini settings that make all PHP scripts work with a specific PHP handler, including SuPHP. Each script may have unique requirements that could involve php.ini changes; to know what php.ini settings are required you would need to check the developer or vendor web site from where you obtained each PHP script. For the main php.ini file, you may want to consider finding a balance where the least problems occur while also trying to maintain some level of security and performance; you will have to test each PHP script to know with certainty what will work and what will not work.
     
  8. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Where in the world did you get that idea from? :D

    You can use most anything with SuPHP without any modifications whatsoever as long as you remember the golden rule to disregard
    script instructions that tell you to set files and folders to 777!

    Setting permissions to 777 is neither required nor permitted under SuPHP.

    On rare occasion, you may run into a script where the programmer was a moron and wrote their script to test for permission '777' alone instead of checking to see if they could actually write to the file they need to write to. In these rare instances, you might actually need to do a modification to the script but it's almost always just commenting out or changing one single line alone and then everything works perfectly!

    The point is that I have never seen a single script anywhere that I haven't been able to use flawlessly with SuPHP with very little effort!
     
Loading...

Share This Page