No announcement yet.

Need help making a .CGI file a PHP file - strange but true.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help making a .CGI file a PHP file - strange but true.

    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!

  • #2
    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


    • #3
      Or, an even better application for mass replacing in files - Search and Replace by Funduc


      • #4
        Umm... that's what I was talking about UltraEdit has that feature.


        • #5
          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


          • #6
            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.


            • #7
              Thanks for all the suggestions, as usual.


              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.