hmdrest1 Posted October 15, 2017 Posted October 15, 2017 Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, webmaster@hmdrest1.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. i've been trying to invoke my php scripts and this is all i see for the last week. It wasn't about connecting to your sql db because i see the same error when i just run <?php echo "something" ?> If i run the same script on my localhost with apache it ran fine. Any idea what's causing this and if i did something wrong?
Bailey Posted October 15, 2017 Posted October 15, 2017 Are you using the correct syntax? And make sure that you DO NOT have debugging on in your .htaccess file (it should not contain anything to do with PHP). Also, posting your whole script would be good so I can see if its an error with your script because sometimes they run on apache localhost fine but not on these servers, Ive had this same problem before!
wolstech Posted October 15, 2017 Posted October 15, 2017 Check the file permissions. They need to be 644. Odds are you have them set to 664 (Apache does not like php files being writable by the group) since the SFTP upload settings we use default to 664. Our servers have display_errors enabled by default, so if it was the script, php would spit out errors instead of a 500.
Bailey Posted October 15, 2017 Posted October 15, 2017 Oh okay @wolstech, It must have been an error with my .htaccess file when I encountered the error because I was displayed with a 500 Server error.
wolstech Posted October 15, 2017 Posted October 15, 2017 Yeah bad htaccess files will do that. First step for any 500 error is generally to rename .htaccess if it exists so its ignored. File permissions come second, then after that it gets a little more difficult to solve (python files with bad shebang lines, etc.)
hmdrest1 Posted October 16, 2017 Author Posted October 16, 2017 thanks for all the replies. All my php files are on 0664 permission , under public_html.. and I can't find the .htaccess file anywhere on my file manager, even when i used the search box on right upper corner with 'Show Hidden Files' enabled..@Bailey. I had other more complicated scripts but as soon as i bumped into this i started just testing with a simple script like this:<?php echo "ok"?> .. and it's 500. I tried to replace all my php script from filezilla once. Do you think i accidentally deleted the htaccess file? i dont know what that file is. and it's the first time i know such a thing exist
Bailey Posted October 16, 2017 Posted October 16, 2017 <? echo "You forget the ending"; ?> Dont forget the ";" after every command, perhaps thats why? Or Clear your cache, the old files might be cached. Also, you dont need to know what a .htaccess file is if you dont have one
wolstech Posted October 16, 2017 Posted October 16, 2017 thanks for all the replies. All my php files are on 0664 permission , under public_html..Change them to 644 and they’ll work.
hmdrest1 Posted October 16, 2017 Author Posted October 16, 2017 (edited) @ bailey i dont know where the cache is thanks for all the replies. All my php files are on 0664 permission , under public_html..Change them to 644 and they’ll work. it worked. but i dont understand why, taking away group write permission has anything to do with script being executable? edit: sorry u just said (Apache does not like php files being writable by the group) . that's one weird thing to know Edited October 16, 2017 by hmdrest1
wolstech Posted October 17, 2017 Posted October 17, 2017 It’s actually suPHP (the apache module that lets php run as the file owner as opposed to the apache user, which is typically nobody) that doesn’t like it. It poses a security risk for files to be writable by the group, so it refuses to run files that aren’t given proper permissions.
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