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.

TIP: PHP 5.1.6 + phpsuexec + local php.ini (register_globals)

Discussion in 'General Discussion' started by Bazer, Jan 13, 2007.

  1. Bazer

    Bazer Member

    Joined:
    Feb 18, 2005
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hello.

    If you're using phpsuexec with PHP 5.1.6 and need to override the global PHP configuration with local php.ini files, then you have the same problem I did: this was bug in PHP and it's now gone.

    You need to modify the apache's suexec in such a way to pass the PHPRC enviroment variable to PHP.

    If you do this it will be at your own risk.

    Here's how I did it:
    - Install apache and PHP with phpsuexec normally with /scripts/easyapache
    - cd /home/cpapachebuild/buildapache
    Tricky part:
    - Determine which suexec patch applies to your installation. Mine was "apache_1.3.37-php-suexec-mod_ssl-patch", your's will probably have a different version like "1.3.33", it also might lack the "mod_ssl" part.
    - Modify it:
    a) Find a line like this:
    Code:
    +++ apache_1.3.31/src/support/suexec.c  Wed May 12 17:28:33 2004
    a couple lines below you should find this:
    Code:
    * There is no initgroups() in QNX, so I believe this is safe :-) 
    @@ -238,13 +245,38 @@
    modify it like this:
    Code:
    * There is no initgroups() in QNX, so I believe this is safe :-) 
    @@ -89,4 +89,5 @@
     char *safe_env_lst[] =
     {
    +    "PHPRC=",
         /* variable name starts with */
         "HTTP_",
    @@ -238,13 +245,38 @@
    - Run "./buildscript" from "/home/cpapachebuild/buildapache"

    If everything goes well the script will install everything like during a normal easyapache run with the settings you chose in the first step.

    Now you have to create a php.ini file (in the users home directory preferably) and ensure proper ownership (his/her) and permissions (readable by the user).

    Now create a .htaccess file in the account's public_html directory with the following line:
    Code:
    SetEnv PHPRC "/home/joe"
    Where "/home/joe" is the directory with php.ini.

    The configuration override works like a "php_value" override so you don't need to copy files to every subdirectory with scripts.

    I hope this will be useful.
     
Loading...

Share This Page