How do I include a php file on a different cpanel account?

Matthew Utzig

Registered
Aug 17, 2018
1
0
1
United States
cPanel Access Level
Website Owner
I have six cpanel accounts which all use the same code. I want to move all of this code to a seventh user. This would allow me to update the shared code for the 6 users at the same time. However, whenever I try to include a php file from the seventh user, I get a permission denied error.

For example, 'require_once(/home/testuser/public_html/index.php)' results in the following warning:

[19-Sep-2018 22:21:48 UTC] PHP Warning: require_once(/home/testuser/public_html/index.php): failed to open stream: Permission denied in /home/<removed>/public_html/test.php on line 1

How can I fix this problem?
Note: The index.php file has permissions 755.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Hello @Matthew Utzig,

Sharing a single path to a PHP file across multiple accounts is not a good security practice and thus we don't recommend doing that. Have you considered using Git instead? You could setup automatic deployment to multiple Git repos after pushing changes from the source. Take a look at the following guide for more information:

Guide to Git - cPanel Knowledge Base - cPanel Documentation

Let me know if you have any questions.

Thank you.