Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Sep 2009
    Posts
    12

    Default php.ini for one user

    Hello,
    I've got a dedicated server with cPanel. A lot of friends have an account on it, no commercial use. But I don't trust all of those friends, I think the chance that one of those friends breaks the server or uses it for wrong purposes is big. The problem is: I am creating a website where users can upload files, everything is working great, but these files can be up to 5GB. Is there a possibility to set a php.ini for one user? So that my account got limits of 5GB while others still got limits of 8MB?

    Thanks,
    NLCJ

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2008
    Location
    PK
    Posts
    443

    Default Re: php.ini for one user

    You can copy a server level php.ini from /usr/local/lib/php.ini into a folder say /home/user/phpconfig and then add the line below to the .htaccess file of your account.

    Code:
    suPHP_ConfigPath /home/user/phpconfig
    You can then update the variable upload_max_filesize in this local file to 5GB.

    Note: You are allowed to use a local php.ini if you are running SuPHP. You can confirm and/or change this in WHM under the tab "Service Configuration >> Apache Configuration >> Configure PHP and SuExec > PHP 5 Handler".

    Quote Originally Posted by NLCJ View Post
    Hello,
    I've got a dedicated server with cPanel. A lot of friends have an account on it, no commercial use. But I don't trust all of those friends, I think the chance that one of those friends breaks the server or uses it for wrong purposes is big. The problem is: I am creating a website where users can upload files, everything is working great, but these files can be up to 5GB. Is there a possibility to set a php.ini for one user? So that my account got limits of 5GB while others still got limits of 8MB?

    Thanks,
    NLCJ
    1 solution works for all problems. Trying harder!
    HostMasterTips - Understanding Tech Support

  3. #3
    Member wayne_mu's Avatar
    Join Date
    Dec 2009
    Posts
    12

    Default Re: php.ini for one user

    Hi,

    As JawadArshad said , you can copy the server's php.ini into the account.

    You can get the the path of the php.ini from the command :

    php -i | grep php.ini
    Mostly it's /usr/local/lib/php.ini .

    Then you can copy php.ini under /home/username/public_html . I suggest you not to change the ownership of php.ini (that is keep it as root so that the user won't be able to make any changes to it).

    After copying , you can write the following code unde the account's .htaccess

    SetEnv PHPRC "/home/username/public_html"
    that is the path of php.ini .

    The above will make the settings under php.ini be applicable to the entire account.

    If you want the change to be applicable only for a subfolder, then you can copy the server's php.ini under that subfolder and then you can write the code as below under the .htaccess

    SetEnv PHPRC "/home/username/public_html/subfolder"
    Hope this helps

    -----------------------------------------------
    esds Data Center

Similar Threads & Tags
Similar threads

  1. (php run in what mode the following, the user can customize your php.ini)
    By liang3391 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-17-2010, 12:55 AM
  2. php.ini on user folder
    By alex2k in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-03-2008, 07:21 AM
  3. user php.ini ignored
    By EWD in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 12-15-2007, 04:27 PM
  4. user local php.ini
    By lukaschemp in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 10-25-2007, 09:13 AM
  5. Can i creat php.ini for a user ?
    By cLub2Share in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-17-2006, 08:30 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube