PDA

View Full Version : Need help making a .CGI file a PHP file - strange but true.



UserName
Thu 17th Aug '00, 5:02am
Hi all. I need help. I have 6000+ .shtml pages on one of my sites that use server side includes to bring banners into each page. The include is a simple little line that goes something like this:
<!--#include virtual="/centralad/ssirand.cgi?REGION=navbot"-->

I stopped using CentralAd a while back, and I wrote a small CGI script (and named it ssirand.cgi) that brings in banners from an external rotation service. So far so good.

Now I want to start using a PHP banner rotation script. But, I don't want to have to go through 1000's of pages and make changes to each one and then re-upload them. I thought that a simple solution would be to make all of the .CGI files in the CentralAd directory into PHP files, then when I called ssirand.cgi, I would actually be calling a PHP file instead of a CGI file. I tried using an htaccess with the line:
AddType application/x-httpd-php .cgi

But, it didn't work. If you change the .cgi to .html in the above, it does work to change my .html files into PHP files. I am wondering if it has something to do with the way the server is set up to handle .CGI files. I'm thinking that maybe I need to have a command in my .htaccess to tell the server that .CGI files in this directory are not really CGI, they are just PHP. I am lost for now and would appreciate any suggestions on how I might do this.

Thanks and take care!

Mike Sullivan
Thu 17th Aug '00, 1:27pm
Well, what I would do, actually, is download UltraEdit and use their "Replace in Files" feature. You could do one mass search and replace through every file... with one press of a button :)

http://www.ultraedit.com

bira
Thu 17th Aug '00, 1:51pm
Or, an even better application for mass replacing in files - Search and Replace by Funduc http://www.funduc.com

Mike Sullivan
Thu 17th Aug '00, 3:09pm
Umm... that's what I was talking about :) UltraEdit has that feature.

bira
Thu 17th Aug '00, 5:07pm
Ed, in Ultra Edit you can only replace a word or a line. If you ever need to replace a segment, you couldn't do it. Search and Replace has awesome features including very easy segment replacement. Try it and see the difference yourself :)

Mike Sullivan
Thu 17th Aug '00, 5:30pm
Actually, UltraEdit does have some simple regular expression functions. I'm not to skilled in using them though :)

However, from what I gathered from the first message, he just wanted to replace that one string with something else.

UserName
Tue 22nd Aug '00, 3:24am
Thanks for all the suggestions, as usual. :)