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

    Joined:
    Apr 25, 2010
    Messages:
    12
    Likes Received:
    2
    Trophy Points:
    53
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    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 :
    https://mywebsite45.com/api_test_xxxxx/show-error.php?uid=184715635058e74417d9084559844178&v=0.4.89
    https://anotherwebsite.com/api_test_xxxxx/show-error.php?uid=184715635058e74417d9084559844178&v=0.4.89

    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

    Joined:
    Apr 11, 2011
    Messages:
    37,171
    Likes Received:
    1,295
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    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.
     
Loading...

Share This Page