Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to make a website on my school's server, but they have PHP installed as CGI, so .php files can only run in the cgi-bin folder.
This is somewhat problematic if I want my index to be a .php file and not a .html, since it needs to be outside of the cgi-bin folder and in the root WWW folder.

Furthermore, it's an apache server, so I tried editing my .htaccess file only to realize i don't know where the php-cgi binary is (this is my school's server, after all, and I don't have permissions just to explore).

Is there any other way of getting the .php index file which is outside of the cgi-bin folder to work without having to do something ugly like make an index.html file in the root directory which redirects to a .php file within the cgi-bin folder?

share|improve this question

migrated from Jul 31 '09 at 10:47

This question came from our site for professional and enthusiast programmers.

There must be a reason why your school does that. Mostly it's called security. Ask your tutor how you can do this. – Elyse Jul 31 '09 at 10:08
obviously it's for security. my "tutor," ie the IT department, has not responded yet. i don't imagine they will anytime soon either, which is why i am here. – Anonymous Jul 31 '09 at 10:36

2 Answers 2

You have a few options. If mod_rewrite is switched on, you can use that to rewrite requests to a path in your /cgi-bin/. $_SERVER[] will still contain the original request URI so that you can conditionally perform actions based on the requested path.

Alternatively, if you’re dead set on using .htaccess to enable PHP files to be executed anywhere (which might not even be possible—httpd.conf specifies, via the AllowOverride directive, what .htaccess files can and can't do), then create a PHP file containing


and place it in your cgi-bin directory, it will tell you all of the relevant details about that installation of PHP, (which should include the location of the php-cgi executable).

share|improve this answer

You could just create an index.html file with a meta redirect, it won't clean up the URL's but at least it would work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.