Jump to content


Photo

Problems running PHP files in certain directories.


  • Please log in to reply
3 replies to this topic

#1 toasty

toasty
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 09 September 2006 - 07:57 PM

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:

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


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?

Thanks

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 12:03 AM

500 errors (Internal Service Error) are normally down to configuration
Is the cgi-bin set up correctly?

Tell me the problem, I will try tell you the solution

#3 toasty

toasty
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 10 September 2006 - 01:12 AM

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.

#4 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 10:05 AM

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
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users