To fix this problem, find a fresh copy of the script, and use a text editor like Notepad (for Windows) or BBEdit (for Mac).Īn HTTP 500 error can be caused by a problem with your Apache configurations. Was the script recently edited in a word processing program like Microsoft Word or Wordpad? CGI programs and other scripts should only be edited with a text editor like Notepad. Using a Perl test script, or a Python test script that ends in. For example, if you are having trouble with a Python script named myfile.py, search for a Python test script, and give the file a. You can use the which command to find the path to Perl (or any other programming language or command) with the command:ĭo the scripts have permission to run in the folder where they are located? You may want to find a simple test script to check this.īe sure your test script is in the same language as the one you are troubleshooting, and uses the same file extension. For example, if you have a Perl script, it will start with the path to Perl. If those are correct, examine the scripts themselves.Īre they in the right place, and named correctly? Verify that the scripts have not been moved, deleted, or renamed by accident.Īre the file paths correct? Many scripts will require other files and programs in order to run. If your website relies on scripts (such as Perl or CGI files), there are a number of things that can go wrong. Once you have finished troubleshooting, be sure to set the file back to the correct permissions. This permissions level can be risky, because it allows anyone to rewrite your file. If you are still receiving an error when you run your script, try setting it to global read/write/execute permissions for testing purposes. Most scripts will require read/write/execute permissions for the owner, and read/execute permissions for group and world. To change the permissions for a file, you need to use the chmod command, along with the numerical value of the permissions level you want to set. The permissions are shown in groups of three: The first block of letters lists the file’s permissions. Use the ll command to list all files and file details. To check the permissions of files on a Linux system, connect via SSH to your server and go to the directory where the files are kept. Most Perl and CGI files need to have their permissions set to 755. Check the permissions on all of your main folders and scripts. Once you find the error, copying and pasting it into Google will often yield helpful results.Īn HTTP 500 error can be caused by a permissions problem with your website’s files or folders. You can also view the last 10 lines in the error log with the command:.You should see the error appear in the log file. Without closing the SSH session, go to a web browser and refresh the page to generate the 500 error again. First, in your SSH session, use the command: If you are not sure what is causing the error, you can follow the error log in one window and watch it being generated.This will return any lines which have the file name in them. If you know that a particular script is causing the error, you can search the file for this script name by using the command: If the error log is large, it can be difficult to find the correct line.Typically these are located in the website’s /logs/ directory. The location of these log files will be specified in the site’s Apache configurations. If you have multiple websites hosted on your server, they will likely have their own error logs.On a Linux server, the default location for the main website error log is /var/log/httpd/error_log. Your first stop should be your website’s error logs.If the problem persists after you refresh the page, continue troubleshooting. Sometimes this error is caused when a service restarts, and you happen to catch it at exactly the wrong time. The first thing to do when you encounter this error is wait a moment and then refresh the page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |