500服务器脚本执行失败错误PHP

500服务器脚本执行失败错误PHP,php,arrays,Php,Arrays,这是webapge所说的: Description: The server encountered an internal error or misconfiguration and was unable to complete your request. Most common reasons for returning this error message are: • File Upload Mode When you upload Perl, CGI scripts via FTP

这是webapge所说的:

 Description: The server encountered an internal error or misconfiguration and was unable to complete your request.

Most common reasons for returning this error message are:

• File Upload Mode
When you upload Perl, CGI scripts via FTP you should use always ASCII mode. If you get "Error 500: Script Execution Failure" you should check whether your FTP client uses ASCII mode when uploading your scripts, because if it uses BINARY mode to upload your scripts they won't work on the server. The problem caused by wrong upload mode is associated with the way different operating systems handle the "end of line" character. Unix system uses a "line-feed" (LF), Windows uses a "carriage-return" (CR) and "line-feed" (LF) pair. That's why it is very important that you set the uploading mode to ASCII.

• File Permissions
When you upload scripts via FTP the file permissions are set by default to 755. If you get "Error 500: Script Execution Failure" you should check whether your scripts have 755 permissions. Otherwise your scripts have lower level of permissions and does not support execution upon request. The octal representation of the 755 permission is equal to the following textual format: -rwxr-xr-x
Most FTP clients support the CHMOD command which is used for setting file permissions. In case you have set improper permissions to your scripts, use your FTP client and set "Read, Write, Execute" permissions for the owner, "Read, Execute" permissions for the group and everyone else.

• Script Errors
This is the third well known reason for getting "Error 500: Script Execution Failure" upon execution of your scripts. Check your scripts for any obvious syntax or programming errors to make sure your code is not broken.



Remember: When you get a "Error 500: Script Execution Failure", you should always check for any file uploading problems (ASCII/BINARY) and the executable permission settings. Once those are checked and verified, it looks like there is a syntax error or some other problem in the script. 
但是,我已经检查了Filezilla(FTP),它使用ASCII模式,文件权限都设置为755

我假设这是一个脚本错误,但我不确定我做错了什么。有两个PHP文件,一个包含在另一个中,另一个包含在主网页中

listofclasses.php
包含在名为
myschedule.php

listofclasses.php中,包含了
classlistarray.php

我想在
listofclasses.php
文件中的
classlistary.php
中使用一个数组

Classlistarray.php代码:

<?php

$listofclasses=array();

/* Other */
array_push($listofclasses,"Free");

/* Math Courses */
array_push($listofclasses,"Math Anal/Intro Calc-Thomas");
array_push($listofclasses,"Math III- Kolluri");

/* Science Courses */
array_push($listofclasses,"Physics- Tetler");
array_push($listofclasses,"Physics- Stanton");
array_push($listofclasses,"Physics-Lane");
array_push($listofclasses,"Chemistry-Lane");
array_push($listofclasses,"Chemistry- Coakley");

/* English Courses */
array_push($listofclasses,"English I- Steele");
array_push($listofclasses,"English I- Peterson");
array_push($listofclasses,"English I- Anderson");
array_push($listofclasses,"English II- Infante");

/* Language Courses */
array_push($listofclasses,"Spanish II- Keas");
array_push($listofclasses,"Spanish II- Parragas");
array_push($listofclasses,"Spanish III- Keas");

/* History Courses */
array_push($listofclasses,"Western Civ- Paige");
array_push($listofclasses,"World Civ- Kojan");
array_push($listofclasses,"World Civ- Gumbert");

/* Electives */
array_push($listofclasses,"Beginning Instruments- Patzner");
array_push($listofclasses,"Beginning Debate- Green & Hines");
array_push($listofclasses,"Advanced Debate- Green");
array_push($listofclasses,"Advanced Debate- Hines");
array_push($listofclasses,"Drawing and Design- Williams");

    ?>
<?php

include "classlistarray.php"; //Get Listofclasses array

for ($i=0; count($listofclasses); $i++) {
    echo '<option>';
    print_r($listofclasses[$i]);
    echo '</option>'; //For each class in the array, print out <option>Class</option>
}

   ?>

Listofclasses.php代码:

<?php

$listofclasses=array();

/* Other */
array_push($listofclasses,"Free");

/* Math Courses */
array_push($listofclasses,"Math Anal/Intro Calc-Thomas");
array_push($listofclasses,"Math III- Kolluri");

/* Science Courses */
array_push($listofclasses,"Physics- Tetler");
array_push($listofclasses,"Physics- Stanton");
array_push($listofclasses,"Physics-Lane");
array_push($listofclasses,"Chemistry-Lane");
array_push($listofclasses,"Chemistry- Coakley");

/* English Courses */
array_push($listofclasses,"English I- Steele");
array_push($listofclasses,"English I- Peterson");
array_push($listofclasses,"English I- Anderson");
array_push($listofclasses,"English II- Infante");

/* Language Courses */
array_push($listofclasses,"Spanish II- Keas");
array_push($listofclasses,"Spanish II- Parragas");
array_push($listofclasses,"Spanish III- Keas");

/* History Courses */
array_push($listofclasses,"Western Civ- Paige");
array_push($listofclasses,"World Civ- Kojan");
array_push($listofclasses,"World Civ- Gumbert");

/* Electives */
array_push($listofclasses,"Beginning Instruments- Patzner");
array_push($listofclasses,"Beginning Debate- Green & Hines");
array_push($listofclasses,"Advanced Debate- Green");
array_push($listofclasses,"Advanced Debate- Hines");
array_push($listofclasses,"Drawing and Design- Williams");

    ?>
<?php

include "classlistarray.php"; //Get Listofclasses array

for ($i=0; count($listofclasses); $i++) {
    echo '<option>';
    print_r($listofclasses[$i]);
    echo '</option>'; //For each class in the array, print out <option>Class</option>
}

   ?>

您的循环没有检查条件
$i
它应该是

for ($i=0; $i<count($listofclasses); $i++) {
    echo '<option>';
    print_r($listofclasses[$i]);
    echo '</option>'; //For each class in the array, print out <option>Class</option>
}
对于($i=0;$i此行:

for ($i=0; count($listofclasses); $i++) {
应该是:

for ($i=0; $i < count($listofclasses); $i++) {
for($i=0;$i
如果主机上有cPanel,请检查ErrorLog@PrixcPanel不需要检查错误日志。它们应该以某种方式在几乎每个主机提供商上都可用。它可能是您的for循环吗?for($i=0;$i