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.

customized php.ini

Discussion in 'General Discussion' started by hostnex, Oct 14, 2010.

  1. hostnex

    hostnex Well-Known Member

    Joined:
    May 2, 2008
    Messages:
    77
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Islamabad, Pakistan, Pakistan
    cPanel Access Level:
    Root Administrator
    Is there any way in cpanel with the help we can allow our clients to run their on php.ini files but with limited values ?

    Lets suppose to allow clients to specify their own memory limit in their own custom php.ini file but if they try to set memory limit greater then 100 MB or any value that is very high then they should not be able to do it.

    We need this as some websites require more memory then others but if we set any value in global php.ini then it will be assigned to all of the websites not to the specific one.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Which PHP handler and PHP version are you using? The answer will depend on your PHP handler and version.

    If you are using PHP 5.3+, you can define path variables in the global php.ini file:

    Code:
    [PATH=/home/username/public_html]
    memory_limit=100M
    For each user that you want to allow the higher limit, simply put the path to that user's home directory, then the changes to the variables you want to allow. I'd put this at the bottom of the /usr/local/lib/php.ini file. This will only work on PHP 5.3+ not PHP 5.2

    It should conceivably work for the various PHP handlers, but I've only tested it on FCGI and suPHP. Prior to PHP 5.3, I have no idea how you'd accomplish what you want to accomplish in suPHP. In DSO for PHP 5.2, you might be able to define the values in include files in /usr/local/apache/conf/userdata/std/2/username (where username is the cPanel username) location with php_value memory_limit 100M to hard code it.
     
  3. hostnex

    hostnex Well-Known Member

    Joined:
    May 2, 2008
    Messages:
    77
    Likes Received:
    1
    Trophy Points:
    8
    Location:
    Islamabad, Pakistan, Pakistan
    cPanel Access Level:
    Root Administrator
    Unfortunately we are using 5.2 and can not upgrade on php 5.3 at the moment as some websites are not compatible with it.

    We are using CGI handler. Is it better to use DSO or FastCGI. What are their advantages over CGI
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I have a handler comparison chart you can use. I did have it up on my forum, but I don't have that online right now, so just attaching it here.

    Personally, if you are running CGI, you would be better going to FCGI or suPHP, since CGI isn't terribly fast anyway. There's no speed benefit nor high security benefit for CGI over DSO either.
     

    Attached Files:

Loading...

Share This Page