Running PHP file outside of documentroot (cgi-bin folder)

后端 未结 5 1410
慢半拍i
慢半拍i 2021-01-25 13:22

I am working with a colleague to set up their local environment on a MAC in XAMPP, on windows my vhost looks like the one below.

When I access a URL like http://domain.l

5条回答
  •  迷失自我
    2021-01-25 13:58

    There is (very) rarely a need to run PHP scripts as CGIs given that the PHP module for Apache can execute them directly. Try adding this to your Apache config:

    
        SetHandler application/x-httpd-php
    
    

    Afterwards simply place the PHP scripts into the document root for the site and see if they work. You'll want to remove the /cgi-bin/ part of the URL.

    You say you're setting XAMMP on a Mac, but you have a drive letter (E:) prefixing your paths. OS X does not have drive letters like Windows, and this may also be causing (part of) your issue.

提交回复
热议问题