简体   繁体   English

为什么我的.php扩展文件不能作为CGI在cgi-bin文件夹(Linux服务器)中工作?

[英]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" . 我最近从“ www.domain.com”购买了域名和托管服务。 My hosting is "Linux Hosting". 我的主机是“ Linux主机”。 I prepared a web site with PHP. 我用PHP准备了一个网站。 While I was looking hosting features, there was PHP5 support. 当我寻找托管功能时,有PHP5支持。 After that, in web site configuration, I noticed that PHP5 support is only avaible as a cgi application . 之后,在网站配置中,我注意到PHP5支持仅作为cgi应用程序提供 Up till now, I didn't know what cgi is. 到目前为止,我还不知道cgi是什么。 I researched a bit. 我研究了一下。 I noticed that there is a directory called cgi-bin. 我注意到有一个名为cgi-bin的目录。 I put my php files in it but gave internal server error. 我把我的PHP文件放进去了,但是出现了内部服务器错误。 But in cgi-bin directory, .cgi extensions work. 但是在cgi-bin目录中,.cgi扩展名有效。 when I looked from Internet, I understood that there must add some handler into .htaccess or into httpd.conf. 从Internet上查看时,我了解到必须在.htaccess或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. CGI意味着将PHP配置为与Web服务器(通常为Apache)分开运行,而不是与Web服务器模块相反。

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. 您应该能够简单地将php文件放置在您的Web根目录(通常在/ var / www中),然后在浏览器中导航至该文件,并且一切正常。

Also, make sure you check your apache logs, in /var/log/ 另外,请确保您在/ var / log /中检查了Apache日志

Search the hosting documation. 搜索托管文件。 I bet you will need to add #!/path/to/php at the first line of your scripts. 我敢打赌,您需要在脚本的第一行添加#!/path/to/php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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