tags:

views:

103

answers:

2

My school internal webserver is still running PHP v4.. (Not sure exactly). I went ahead and wrote all the labs and assignments on my local machine, which is running 5.2.5. Now, none of my code works on the school machine because the functionality simply is not there.

I have access to a slew of compilers, and have downloaded the PHP v5.2.9 source code, and am going to compile it for use as a CGI.

My problem? The school has disabled .htaccess files for our accounts, and thus I can't magically redirect all requests to go through my brand new v5.2.9 install.

Does anyone have any ideas, suggestions, hacks, or workarounds to get all requests to go to my cgi version rather than the mod_php version? Is there any way to do this with 301 redirects or something?

Thanks a ton.

+1  A: 

You can do the redirect with… PHP4. Use the header function. Or you can execute your CGI from a PHP4 script using passthru.

kmkaplan
+1  A: 

See if you have a /cgi-bin directory in your web root. Even if it's not there, try creating it and putting your scripts there. Many web servers will by default assume that files in that directory are scripts.

Additionally, you will want to try:

  1. Renaming your scripts with a .cgi extension
  2. Putting a "shebang line" at the top to indicate what interpreter to use. For example:

#!/path/to/php5

Note that it has to be the first line with no spaces.

antonm