Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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 doesn't read php.d ini files

Discussion in 'General Discussion' started by joaosavioli, Dec 5, 2017.

  1. joaosavioli

    joaosavioli Active Member

    Joined:
    Feb 7, 2008
    Messages:
    33
    Likes Received:
    8
    Trophy Points:
    58
    Hello,

    My server has about 2 years.
    When I started this server, I changed the regular php.ini files following this steps bellow, to prevent users have own php.ini.
    The cPanel PHPRC PHP Patch for EasyApache 4 - EasyApache 4 - cPanel Documentation

    The problem is that if I comment again the line (bellow) in /etc/suphp.conf, I get error 500 in all sites with the current php version.
    [phprc_paths]
    application/x-httpd-ea-php54 = /opt/cpanel/ea-php54/root/etc

    I could see that in php phpinfo(), the variable "Scan this dir for additional .ini files" is none. How could I make php read again the folder /opt/cpanel/ea-php54/root/etc/php.d/?

    Thank you
    Joao
     
  2. RickKukiela

    RickKukiela Member

    Joined:
    Jan 17, 2017
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Chicago
    cPanel Access Level:
    Root Administrator
    You need to set the PHP_INI_SCAN_DIR in the environment. I think this can also be set during compilation.

    Here is my output when I do a `php -i` on the command line. You can see the directory is set there. If you do not have this line then you'll have to set it at runtime by setting an environment variable and unfortunately I only know how to do this on windows.


    Configure Command => './configure' ...... '--with-config-file-scan-dir=/opt/cpanel/ea-php56/root/etc/ph
    p.d' .....

    Server API => Command Line Interface
    Virtual Directory Support => disabled
    Configuration File (php.ini) Path => /opt/cpanel/ea-php56/root/etc
    Loaded Configuration File => /opt/cpanel/ea-php56/root/etc/php.ini

    Scan this dir for additional .ini files => /opt/cpanel/ea-php56/root/etc/php.d
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,484
    Likes Received:
    1,612
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  4. joaosavioli

    joaosavioli Active Member

    Joined:
    Feb 7, 2008
    Messages:
    33
    Likes Received:
    8
    Trophy Points:
    58
    Hello,

    Thank you for help.
    What´s the best way to return with the regular php.ini in easyapache4?
    If I just comment the line os path "phprc_paths" in /etc/suphp.conf, I get error 500 in all sites.

    Thank you
    Joao
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,484
    Likes Received:
    1,612
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Here's what /etc/suphp.conf looks like by default:

    Code:
    # cat /etc/suphp.conf
    ; This file is parse anew by suPHP for each request
    ; rather than being loaded once.
    
    [global]
    ;Path to logfile
    logfile = /etc/apache2/logs/suphp_log
    
    
    ;Loglevel
    loglevel = info
    
    
    ;User Apache is running as
    ; MANDATORY
    webserver_user = nobody
    
    
    ; Path all scripts have to be in
    ; This works as a prefix when a trailing slash is not specified.
    ; e.g. /home will match /home /home2 /home3 etc While /home/ will only match /home/
    ;
    ; Changing this to a more specific path will improve security
    docroot = /
    
    
    ;Path to chroot() to before executing script
    ;chroot=/home
    
    
    ; Security options
    allow_directory_group_writeable = false
    allow_directory_others_writeable = false
    allow_file_others_writeable = false
    allow_file_group_writeable = false
    
    ; NOTE: The allow_file_group_writeable option can be: true, false, or cpanel
    ;       See the doc/CONFIG documenation for details.
    ;       The other allow_* options can only be: true or false
    
    ; Check whether script is within DOCUMENT_ROOT
    ; Does NOT perform this check on included scripts.
    ; i.e. include_once("/test3.php"); works even though it's in the root directory
    ;
    ; Changing this to true will improve security but make all php userdir requests fail
    check_vhost_docroot = false
    
    
    ; Allow the user and group specified by a ~userdir request to override the
    ; suPHP_UserGroup directive inside the source virtualhost
    ;
    ; Changing this to false will improve security but make some types of php userdir
    ; requests fail
    userdir_overrides_usergroup = true
    
    
    ; suPHP Paranoid mode checks that the target script UID and GID match
    ; the UID and GID of the user running the script.  To disable these
    ; checks change the following values to false.  Without these checks, mod_suphp
    ; is effectively running in "Force" mode.
    paranoid_uid_check = true
    paranoid_gid_check = true
    
    
    ;Send minor error messages to browser
    errors_to_browser = false
    
    
    ;PATH environment variable
    env_path = "/bin:/usr/bin"
    
    
    ;Umask to set, specify in octal notation
    umask = 0022
    
    
    ; Minimum UID
    ;min_uid=100
    
    
    ; Minimum GID
    ;min_gid=100
    
    ; Normally suPHP only displays the PHP binary in process lists (ps aux).
    ; Setting this option to 'true' will cause suPHP to display both the
    ; PHP binary and the script filename.
    full_php_process_display = true
    
    
    [handlers]
    ;Handler for php-scripts
    application/x-httpd-ea-php54 = "php:/opt/cpanel/ea-php54/root/usr/bin/php-cgi"
    application/x-httpd-ea-php55 = "php:/opt/cpanel/ea-php55/root/usr/bin/php-cgi"
    application/x-httpd-ea-php56 = "php:/opt/cpanel/ea-php56/root/usr/bin/php-cgi"
    application/x-httpd-ea-php70 = "php:/opt/cpanel/ea-php70/root/usr/bin/php-cgi"
    application/x-httpd-ea-php71 = "php:/opt/cpanel/ea-php71/root/usr/bin/php-cgi"
    application/x-httpd-ea-php72 = "php:/opt/cpanel/ea-php72/root/usr/bin/php-cgi"
    
    [phprc_paths]
    ;Uncommenting these will force all requests to that handler to use the php.ini
    ;in the specified directory regardless of suPHP_ConfigPath settings.
    ;[phprc_paths], like suPHP_ConfigPath, is subject to php's PHPRC behavior.
    ;Before using this mechanism make sure to fully understand the implications
    ; of doing so:
    ;     https://go.cpanel.net/EA4PHPHandlers#PHPHandlers-Thesuphp.conffile
    ;     https://go.cpanel.net/PHPRC#ThecPanelPHPRCPHPPatchforEasyApache4-SuPHP
    ;application/x-httpd-ea-php54=/opt/cpanel/ea-php54/root/etc
    ;application/x-httpd-ea-php55=/opt/cpanel/ea-php55/root/etc
    ;application/x-httpd-ea-php56=/opt/cpanel/ea-php56/root/etc
    ;application/x-httpd-ea-php70=/opt/cpanel/ea-php70/root/etc
    ;application/x-httpd-ea-php71=/opt/cpanel/ea-php71/root/etc
    ;application/x-httpd-ea-php72=/opt/cpanel/ea-php72/root/etc
    How does this compare to the contents of this file on your system?

    Thank you.
     
Loading...

Share This Page