Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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

Discussion in 'cPanel Developers' started by Matthew Utzig, Sep 19, 2018.

  1. Matthew Utzig

    Matthew Utzig Registered

    Joined:
    Aug 17, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice