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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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 Forums Analyst
    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.

Share This Page