PHP doesn't read php.d ini files

joaosavioli

Well-Known Member
Feb 7, 2008
64
11
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
 

RickKukiela

Member
Jan 17, 2017
12
1
1
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
 

joaosavioli

Well-Known Member
Feb 7, 2008
64
11
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
What´s the best way to return with the regular php.ini in easyapache4?
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.