简体   繁体   English

perl 500内部服务器错误php包括

[英]perl 500 Internal Server Error php include

I am trying to run PHP file in Perl using PHP::Include but browser getting 500 Internal Server Error 我正在尝试使用PHP::Include在Perl中运行PHP文件,但浏览器却收到500 Internal Server Error

Here is my code: 这是我的代码:

#!/usr/local/bin/perl

use PHP::Include;
include_php_vars( 'file.php' );
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>\n";

test your file.php for compilation errors. 测试您的file.php编译错误。

php file.php

while in that folder, test the script you are using 在该文件夹中,测试您正在使用的脚本

perl scriptname.pl

so that std error will be displayed (instead of the generic 500 error you are seeing when running the script through CGI). 因此将显示std错误(而不是通过CGI运行脚本时看到的一般500错误)。

I notice that you are printing your header ( print "Content-type: text/html\\n\\n"; ) after doing the php include. 我注意到您在执行php include之后正在打印标题( print "Content-type: text/html\\n\\n"; )。 Depending on what is actually in your php script, any non-header output before the header would result in a 500 error. 根据您的php脚本中的实际情况,标头之前的任何非标头输出都会导致500错误。

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

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