eliashas Posted August 7, 2014 Posted August 7, 2014 Hello, world! Let me first of all say that I greatly appreciate the exsistence of Heliohost, a free, honest hosting provider with support for pure python 3.4. Just what I was looking for. I guess the following problem is a minor one. It gives me an opportunity to say hello. :-) I have created a web application in Python, which runs smoothly on my localhost, but does not load at all on heliohost. I have even reduced the complexity to a simple Hello world: http://eliashasle.heliohost.org/cgi-bin/helloworld.py Internal server error 500, it seems.500 errors can be caused by a lot of things. The most common areExceeding Process Limit The solution is to not run as many processes. Opening cpanel' date=' connecting to FTP, checking mail, connecting to webdisk, etc all increase your process count, and if you exceed your limit php will show 500 errors since it cannot start a new php process. This sometimes affects only the webmaster since opening cPanel and FTP etc is common when you're editing your site, but normal users won't have these errors since they will only be accessing your website not all the other services. The process limit is higher on Johnny so for some websites the solution to 500 errors might be to switch servers.Syntax Error in .htaccess If you have a syntax Error in one of your .htaccess files it can cause a 500 error. The easiest way to check if this is the case is to delete or rename your .htaccess files and see if the 500 Error goes away.Incorrect Permissions If the script or the directory that the script is in doesn't have the correct permissions it can cause 500 errors too. If you're running a php script the file permission should be 644. If you're running a cgi script it should have 755 permissions. Your directories should have 755 or 750 permissions.Exceeding Time Limit If your script exceeds the time limit it can be killed by the system which will also result in a 500 error. The solution to this problem is to break your long executing scripts into multiple faster scripts that can call each other. For instance longscript.php always results in a 500 Error because it exceeds the time limit, but if script1.php runs for a short time, and then calls script2.php which calls script3.php they can together execute the same code as longscript.php without exceeding the time limit and being killed.High Server Load If the Server is currently experiencing high Server load scripts can return a 500 Error when they would normally work. This is more common on Johnny than Stevie since Johnny is more unstable, and accounts that cause high load on Stevie are suspended. There isn't really anything that can be done about high load 500 errors other than trying again later when the load is lower.[/quote'] 1. I have tried closing all other connections, like cpanel and ftp.2. No custom .htaccess file.3. Permissions set to 755 for cgi-bin and the scripts within.4. Hello world shouldn't exceed any time limit.5. Possible, but I have tried several times at different times. I don't know if it means anything, but when I try to open the cgi-bin on the web, it says "Forbidden", and in the error log it says that I have tried to run cgi-bin as a script. I have tried to fix the issue by removing the cgi-bin and creating a new one with the right permissions. Any ideas what might be wrong, and how to fix it? :-) PS: Here is the script: #!/usr/bin/env python print("Content-Type: text/html;charset=utf-8\n\n") print("&--#60;html&--#62;&--#60;body&--#62;&--#60;p&--#62;Hello, world!&--#60;/p&--#62;&--#60;/body&--#62;&--#60;/html&--#62;")
Tjoene Posted August 7, 2014 Posted August 7, 2014 I don't know much of python, but doesn't shebang line be something like this: #!/usr/bin/python
eliashas Posted August 7, 2014 Author Posted August 7, 2014 Thanks for your reply. Well, sadly it didn't work with your suggested change either.
hussam Posted August 7, 2014 Posted August 7, 2014 I don't know much of python, but doesn't shebang line be something like this: #!/usr/bin/python env looks for 'python' in PATH variable (/usr/bin/ doesn't need to be in PATH to work) then looks in the standard /usr/bin. This works around situations where python is not installed in /usr but instead in /usr/local/ but /usr/local/bin is defined in PATH.env prints all currently defined environment variables.
eliashas Posted August 8, 2014 Author Posted August 8, 2014 I don't know much of python, but doesn't shebang line be something like this: #!/usr/bin/python env looks for 'python' in PATH variable (/usr/bin/ doesn't need to be in PATH to work) then looks in the standard /usr/bin. This works around situations where python is not installed in /usr but instead in /usr/local/ but /usr/local/bin is defined in PATH. env prints all currently defined environment variables. Thanks for the info. Does this mean that /usr/bin/env python is safe? By the way, I have rewritten and (hopefully) clarified the original post, and am hoping for new answers. Could this thread actually be off-topic here?
hussam Posted August 8, 2014 Posted August 8, 2014 replace it with#!/usr/bin/python to be safe since you know python is is installed in /usr. there is no need for env.
eliashas Posted August 13, 2014 Author Posted August 13, 2014 I have reposted this in Customer Service, where I think it belongs: http://www.helionet.org/index/topic/19684-yet-another-500-internal-server-error-reposted-in-correct-forum/page__hl__%2Binternal+%2Bserver+%2Berror__fromsearch__1
support2you Posted August 23, 2014 Posted August 23, 2014 go to cpanel and enter to ftp manger befor enter choes show hide filethen delete file .htaccessin ftp you cant see it but when choies show hidding file will you see it
wolstech Posted August 24, 2014 Posted August 24, 2014 Did you create the script on windows by chance? Our python won't work with scripts containing windows line endings. Someone else on he had this exact issue recently, and the symptom is just a 500 error.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now