0

This is what the webapge says:

 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. 

However, I already checked Filezilla (FTP) and it uses ASCII mode, and the file permissions are all set to 755.

I assume its a script error, but I'm not sure what I'm doing wrong. There are 2 PHP files, one included in another, and another included in the main web page.

listofclasses.php is included in a page called myschedule.php

Inside listofclasses.php, classlistarray.php is included

I want to use an array in classlistarray.php in the listofclasses.php file

Classlistarray.php code:

<?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");

    ?>

Listofclasses.php code:

<?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>
}

   ?>
6
  • If you have cPanel on your host check the ErrorLog Commented Aug 5, 2013 at 19:21
  • @Prix cPanel isn't required to check the error logs. They should be available on nearly every hosting provider in some fashion. Commented Aug 5, 2013 at 19:23
  • Could it be your for loop? for ($i=0; $i < count($listofclasses); $i++), honestly its been a while since i have been in PHP. Commented Aug 5, 2013 at 19:26
  • @StevenV yes they are however to new people accessing from cPanel could be an easier approach to it as it is also available on the panel. Commented Aug 5, 2013 at 19:27
  • cPanel Error Log isn't available in my free hosting package with Awardspace- is there a way to print errors at runtime in the PHP file itself? Commented Aug 5, 2013 at 19:29

2 Answers 2

1

This line:

for ($i=0; count($listofclasses); $i++) {

Should be:

for ($i=0; $i < count($listofclasses); $i++) {
Sign up to request clarification or add additional context in comments.

Comments

1

Your loop doesn't check for the condition $i < count($listofclasses) it should be

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>
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.