DEV Community

Pradeep Kumar
Pradeep Kumar

Posted on • Edited on

How to change CPanel account root directory.

Step 1

Update variable documentroot in following two file:

sudo nano /var/cpanel/userdata/<cpanel-username>/<example.com>
sudo nano /var/cpanel/userdata/<cpanel-username>/<example.com>_SSL
Enter fullscreen mode Exit fullscreen mode

Replace <example.com> to your actual domain.

You need update following line in both files:

documentroot: /home/<cpanel-username>/public_html
Enter fullscreen mode Exit fullscreen mode

to your target folder.

Eg:

documentroot: /home/<cpanel-username>/public_html/public
Enter fullscreen mode Exit fullscreen mode

Step 2

Then edit:

sudo nano /var/cpanel/userdata/<cpanel-username>/<example.com>.php-fpm.yaml
Enter fullscreen mode Exit fullscreen mode

and add following line

php_admin_value_doc_root: { name: 'php_admin_value[doc_root]', value: /home/<cpanel-username>/public_html/public }
Enter fullscreen mode Exit fullscreen mode

Final file will look like:

---
_is_present: 1
php_admin_value_doc_root: { name: 'php_admin_value[doc_root]', value: /home/<cpanel-username>/public_html/public }
Enter fullscreen mode Exit fullscreen mode

Step 3

Then to rebuild the Apache conf and restart Apache:

/scripts/php_fpm_config --rebuild
/scripts/rebuildhttpdconf

/scripts/restartsrv_apache_php_fpm
/scripts/restartsrv_httpd
service httpd restart
Enter fullscreen mode Exit fullscreen mode

When you visit your url and getting following message:

No input file specified
Enter fullscreen mode Exit fullscreen mode

Simply restart the server, it should be fixed.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay