Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Question Help with custom php.ini

    Quote Originally Posted by jdlightsey View Post
    You have a few different options with mod_suphp...

    1) You can allow the users to set up their own php.ini files as they see fit. This is the default configuration.

    2) You can force all users to use a single php.ini file. This is done by setting the phprc_paths in /opt/suphp/etc/suphp.conf. If you set this it will override any other settings in .htaccess files or httpd.conf.

    3) You can control which php.ini is used for each account using suPHP_ConfigPath. This directive can be used in httpd.conf and in .htaccess files, so if you want to lock a particular account to a certain php.ini you'd need to set suPHP_ConfigPath for that account in an include file and remove Options from the AllowOverride list for that VirtualHost.
    -------------------------------------------------
    Hello,
    i am interested in point number 3 but did not fully get the steps.
    So far, i have installed suphp on the server and i have only one account that needs allow_url_fopen = on , while i want all other users to have it off.
    i tried creating a php.ini inside the public_html but it is not working.
    Can you please help.
    thank you

  2. #2
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,555
    cPanel/Enkompass Access Level

    DataCenter Provider

    Lightbulb

    Quote Originally Posted by richirich View Post
    Hello,
    i am interested in point number 3 but did not fully get the steps.
    So far, i have installed suphp on the server and i have only one account that needs allow_url_fopen = on , while i want all other users to have it off.
    i tried creating a php.ini inside the public_html but it is not working.
    Can you please help.
    thank you
    Please elaborate on what specific details are seen; by "not working" what is the method for testing this and what criteria are you looking for?

    For example; knowing the following information will help to narrow what factors are involved:
    1.) Is a php info page being used to test the value of customized php.ini settings? The following PHP code may be used to setup a custom php info page (e.g., placed in a new file using the ".php" file extension):
    Code:
    <?php
    phpinfo();
    ?>
    2.) Have you ensured that the custom php.ini file contains the directive once and not twice or more (i.e., ensure no duplicate directives)?
    3.) Is the directive "allow_url_fopen" set in the system-wide php.ini and in the user's custom php.ini?
    4.) Was the directive "suPHP_ConfigPath" set in an .htaccess file or other Apache configuration? Customizing this is optional and may not be required.
    5.) Have you confirmed and verified that SuPHP is activated?
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf --current
    6.) Please try the following example to create a custom php.ini for the user, where "username" represents the user involved:
    Code:
    # cp -pv /usr/local/lib/php.ini /home/username/public_html/php.ini
    # chown -v username:username /home/username/public_html/php.ini
    After using the above two commands to create the custom php.ini file then it may be modified as needed.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Default How can i protect PHP.ini with SuPHP?

    Hello, thank you for the quick response.



    Quote Originally Posted by cPanelDon View Post
    1.) Is a php info page being used to test the value of customized php.ini settings? The following PHP code may be used to setup a custom php info page (e.g., placed in a new file using the ".php" file extension):
    Code:
    <?php
    phpinfo();
    ?>

    Richi: i created this to check the php value. it shows:
    Directive Local Value Master Value
    allow_call_time_pass_reference On On
    allow_url_fopen Off Off

    even when the local php.ini is set to on

    Quote Originally Posted by cPanelDon View Post
    2.) Have you ensured that the custom php.ini file contains the directive once and not twice or more (i.e., ensure no duplicate directives)?

    Richi : by not working i meant tat when i insert the new php in the account profile, the new configurations specified there wont apply.


    Quote Originally Posted by cPanelDon View Post
    3.) Is the directive "allow_url_fopen" set in the system-wide php.ini and in the user's custom php.ini?
    Richi reply: it was set to off in the system-wide and on for the customer


    Quote Originally Posted by cPanelDon View Post
    4.) Was the directive "suPHP_ConfigPath" set in an .htaccess file or other Apache configuration? Customizing this is optional and may not be required.
    Richi :i tried setting that from .htaccess but it did not apply. The attempt was as follows " php_value allow_url_fopen 1

    Quote Originally Posted by cPanelDon View Post
    5.) Have you confirmed and verified that SuPHP is activated?
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf --current
    Richi: Although i built apache and php enabling this option
    this was the result i got:
    Available handlers: suphp dso cgi none
    DEFAULT PHP: 5
    PHP4 SAPI: none
    PHP5 SAPI: dso
    SUEXEC: enabled

    should i enable from somewhere in whm?

    Quote Originally Posted by cPanelDon View Post
    6.) Please try the following example to create a custom php.ini for the user, where "username" represents the user involved:

    Code:
    # cp -pv /usr/local/lib/php.ini /home/username/public_html/php.ini
    # chown -v username:username /home/username/public_html/php.ini
    After using the above two commands to create the custom php.ini file then it may be modified as needed.
    Richi: did that already

  4. #4
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,555
    cPanel/Enkompass Access Level

    DataCenter Provider

    Lightbulb

    Quote Originally Posted by richirich View Post
    Richi :i tried setting that from .htaccess but it did not apply. The attempt was as follows " php_value allow_url_fopen 1
    To confirm, when testing the above, did the PHP info page show any change?

    Quote Originally Posted by richirich View Post
    Richi: Although i built apache and php enabling this option
    this was the result i got:
    Available handlers: suphp dso cgi none
    DEFAULT PHP: 5
    PHP4 SAPI: none
    PHP5 SAPI: dso
    SUEXEC: enabled
    Thank you for the excellent details; as the PHP handler is DSO, a custom php.ini file will not work.

    Using DSO, here is an example .htaccess entry to set boolean php configuration directives; this should work if nothing is restricting the ability to customize them (such as safe_mode):
    Code:
    <IfModule mod_php5.c>
    php_flag allow_url_fopen on
    </IfModule>
    Please try the above .htaccess entries, then view the PHP info page once more to verify if the setting changed.
    Reference: (for DSO) PHP: How to change configuration settings - Manual

    If safe_mode is enabled, this will also prevent fopen from working. When viewing the PHP info page, is safe_mode enabled/on or disabled/off?
    Reference: PHP: Functions restricted/disabled by safe mode - Manual

    Please note that when using SuPHP the .htaccess directives beginning with "php_" such as "php_flag" and "php_value" will no longer work, and sites still using them without being wrapped in an IfModule section will show an error until they are either removed/disabled/commented or until they are rendered harmless by containing them in an IfModule section.

    Quote Originally Posted by richirich View Post
    should i enable from somewhere in whm?
    The PHP handler may be switched from DSO to SuPHP via the following area in WHM:
    WHM: Main >> Service Configuration >> Apache Configuration >> PHP and SuExec Configuration
    Documentation: Configure PHP and suEXEC

    For additional verbose details and information please refer to the following documentation:
    Apache PHP Request Handling
    Configuring PHP and suEXEC from the Command Line

    As an alternative to WHM, here is an example showing how to set the PHP handler to SuPHP; the following command will, in this order, set the default PHP version to 5, set the PHP4 handler to none (assuming PHP v4 is not used or not installed), set the PHP5 handler to SuPHP, and set SuExec enabled:
    Code:
    # /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1

  5. #5
    cPanel Quality Assurance Analyst cPanelDon's Avatar
    Join Date
    Nov 2008
    Location
    Houston, Texas, U.S.A.
    Posts
    2,555
    cPanel/Enkompass Access Level

    DataCenter Provider

    Arrow Friendly Moderator Note

    I've moved the above discussions into a new dedicated thread to help differentiate the unique inquiry from the original topic.

    Old Thread: How can I protect php.ini with SuPHP? - cPanel Forums

Similar Threads & Tags
Similar threads

  1. Custom php.ini
    By rahuldas14 in forum New User Questions
    Replies: 1
    Last Post: 06-06-2011, 05:55 AM
  2. php-fcgid+eaccelerator+custom php.ini+apache2-mpm-worker= segfault?
    By internetfab in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-30-2011, 04:25 PM
  3. Custom php.ini
    By sabarishks in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-22-2010, 03:11 PM
  4. Help with custom php.ini
    By richirich in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 01-07-2010, 05:40 PM
  5. custom php.ini with php handler set as cgi
    By johny_gjx in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-16-2009, 03:54 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube