简体   繁体   中英

Why can't my .php extension files work in as CGI in cgi-bin folder(linux server)?

I recently purchased domain name and hosting from "www.domain.com" . My hosting is "Linux Hosting". I prepared a web site with PHP. While I was looking hosting features, there was PHP5 support. After that, in web site configuration, I noticed that PHP5 support is only avaible as a cgi application . Up till now, I didn't know what cgi is. I researched a bit. I noticed that there is a directory called cgi-bin. I put my php files in it but gave internal server error. But in cgi-bin directory, .cgi extensions work. when I looked from Internet, I understood that there must add some handler into .htaccess or into httpd.conf. I am not authoritized to access these files but I can add some handler from "web site configuration" in my hosting.

Iknow I am doing something wrong but I don't know what it is. Thanks...

CGI means that PHP is configured to run as a separate process from your web server (apache usually), as opposed to the module of the web server.

You should be able to simply place the php file at your web root (usually in /var/www), navigate to the file in your browser, and it should all work.

Also, make sure you check your apache logs, in /var/log/

Search the hosting documation. I bet you will need to add #!/path/to/php at the first line of your scripts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM