PHP ignoring modified document root
WHM: 72.0.10 on CentOS 7.5
Not sure what version of EA4 I'm on. It's known that
/usr/local/cpanel/scripts/easyapache --version
will return an error if you're running EA4. The changelog at
"billy"
Domain -> "example.com"
(my apologies to the actual owner of example.com for use of this variable placeholder)
Current Doc Root -> /home/billy/public_html
Desired Doc Root -> /home/billy/web/example.com/public_html
It appears as if PHP is ignoring changes in /var/cpanel/userdata/billy/example.com and only looking for content in /home/billy/public_html
This post:
talks about a non-existant file /var/cpanel/ApachePHPFPM/system.yaml - this would be a global config anyway, and without access to variables specifying the domain in question (rather than just the account owner), such a global file wouldn't be very helpful unless *all* users followed the same folder structure.
There *is* a /var/cpanel/userdata/billy/example.com.php-fpm.yaml, and per the second post adding:
php_admin_value_doc_root: /home/billy/web/example.com/public_html
*seems* to work so far as generating the config files, but no combination of removing the main, SSL or php-fpm cache files, rebuilding the conf, or restarting the server seem to have any effect.
With the updated yaml, one can see the new path in example.cache, but when calling up the domain in a browser it still shows content from /home/billy/public_html, not /home/billy/web/example.com/public_html as expected
Running:
/usr/local/cpanel/scripts/php_fpm_config --rebuild --domain=example.com
and restarting Apache also has no effect.
So, how does one specify a custom doc root for serving php content these days?
For now, the klugde is to make sure /home/billy/public_html is devoid of content, and symlink the correct dir:
ln -s /home/billy/example.com/public_html /home/billy/public_html
but ultimately, that method is not the preferred long-term solution.
Any clues on how to fix this would be most appreciated.
Thanx!
-
Hello @_jman, It looks like the culprit in your case is the syntax used in the individual account's PHP-FPM configuration file: /var/cpanel/userdata/username123/domain.com.php-fpm.yaml
For instance, if you want to set the new document root as "/home/username123/test/public_html", then the contents of this file should look like this:--- _is_present: 1 php_admin_value_doc_root: { name: 'php_admin_value[doc_root]', value: /home/username123/test/public_html }
Once you save the changes to this file, run the following commands:/scripts/php_fpm_config --rebuild /scripts/restartsrv_apache_php_fpm /scripts/restartsrv_httpd
Let me know if this helps. Thank you.0 -
Sorry for the delay in replying; got sidetracked with another project. That did the trick, thanks, all working now. Was that particular syntax documented anywhere? Just curious. 0 -
That did the trick, thanks, all working now. Was that particular syntax documented anywhere? Just curious.
Hello @_jman, I'm glad to see that helped. That specific syntax isn't documented, but we do document the overall syntax requirements at: Additionally, we recently published a resource with information on how to manage php.ini directives with PHP-FPM that you may find helpful: Thank you.0
Please sign in to leave a comment.
Comments
3 comments