Jump to content


This topic is now archived and is closed to further replies.


Problems running PHP files in certain directories.

Recommended Posts

I'm wondering if anyone has had a problem with executing php files whereby they don't run in all directories; and if so if you know of a solution to this.

For instance I ran into this with two seperate files; one pertained to a perl script.  I created a custom .php file located in my /cgi-bin directory and when I tried accessing it from my browser it would spit out:
[quote]Internal Server Error

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

Please contact the server administrator, _________@yahoo.com 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.
Apache/2.0.46 (Red Hat) Server at www.____________.com Port 80[/quote]

I fixed this by placing the .php file in question into a folder that had existing .php files that I knew worked.  After I changed the relative paths in the code it worked fine.  The second problem I ran into was trying to run a .php file from my browser that I had just uploaded into a folder I had just created (permission 777 on folder and file) and I ran into the same "Internal Server Error."  However when I moved the files into my sites root directory it executed without any problems at all.

I'm just wondering if anyone knows if this is a somewhat common problem or if there are ways around it?


Share this post

Link to post
Share on other sites
500 errors (Internal Service Error) are normally down to configuration
Is the cgi-bin set up correctly?

Share this post

Link to post
Share on other sites
I assume the CGI is set up right, I actually just got an email back from support with my site's host and they confirmed that the cgi-bin directory isn't publicly browsable; so that solves the issue regarding the file in that folder.

However, they didn't have anything to say regarding 500 error in the directory I created and just pointed me to see what I could find out online and from www.php.net (because that level of support is outside their scope of responsibility).

So, I'm still trying to figure out why accessing www.mysite.com/folder/file.php didn't work, but www.mysite.com/file.php worked fine.

Share this post

Link to post
Share on other sites
So you are saying, you have the SAME file, in the folder "public_html/"(root) and in another folder "public_html/folder/"(folder in root)

If you view the file in the root, it works, if you view the file in the folder (NOT CGI-BIN) it comes up with 500's

Do you have anohter .HTACCESS file in that folder? (You shouldn't)
If not
Post ur HTACCESS file from the root
If Yes
Post Both

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.