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!

Execute PHP outside of home directoy

Discussion in 'General Discussion' started by Maxence, Jul 6, 2017.

  1. Maxence

    Maxence Member

    Apr 25, 2010
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider
    Hello guys,

    I'm using CPanel with Cloudlinux (cageFS, LVE, etc..)
    I need to execute a PHP file who will be the same for every hosting account, so this file is shared on a different folder, outside from /home/clientAccount, I want to use an Apache Alias for that.

    Example :

    I added an Apache alias on "Pre VirtualHost Include"
    Alias "/api_test_xxxxx" "/opt/myfolder/myfolderapi/"​

    So after restarting Apache, my alias works well because instead of getting a 404 I got a 501 Not Implemented with this message :
    Not supported​

    I would like to know how I can allow Apache to execute my PHP script, which configuration I'm missing ?
    I'm using PHP with CGI.
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    I don't believe this action is recommended due to security restrictions. Instead, you should upload a separate copy of this PHP file to each account, or setup a cron job that populates an updated copy of this PHP file to each account on a regular basis.

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

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