Editing a DocumentRoot problem

veepee

Registered
Sep 6, 2018
2
0
1
India
cPanel Access Level
Root Administrator
I wanted to refer my php files from public_html folder in cpanel's FileManager. For this, i updated all the entries of "DocumentRoot" in httpd.conf file ( /etc/apache2/conf/httpd.conf in CentOS7 ) to /home/user/public_html but after a day it gets updated automatically back to "/var/www/html".

This results in the php files placed under '/var/www/html' only are referred and files in 'public_html' folder in cpanel are not referred.

What is to be done to avoid this auto update ?
 

SS-Maddy

Well-Known Member
Mar 28, 2009
130
18
68
cPanel Access Level
Root Administrator
Hello @veepee

Your requirement is not clear for me. Can you please explain your issue more ? cPanel by default uses /home/user/public_html as its DocumentRoot for a domain hosted in a server.

Or are you saying that you changed from /home/user/public_html to /var/www/html.

In either case, whatever changes you make to the httpd.conf, you should edit it from WHM >> Home >> Service Configuration >> Apache Configuration
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @veepee
You cannot modify the httpd.conf directly all changes made to it will be reverted. The only way to change a domain's document root is to modify the userdata files at
Code:
/var/cpanel/$user/userdata
then run the following:
Code:
/scripts/updateuserdomains
/scripts/updateuserdatacache
mv /etc/apache2/conf/httpd.conf{,.bk}
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd
I want to note that while it is possible to make these customizations this is not something supported by cPanel.


Thanks!