SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2001
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php, safe mode and cgi mode????

    I've bought a subdirectory redirection script (php/mysql) and the guy (www.scripts24.com) says it won't work at safe mode on my shared virtual server. He says i need the cgi mode script.

    So i ask, what is safe mode and what is cgi mode? Do they install differently? Is there a good php/mysql site for idiots, well, beginners?

    Thanks a lot.

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I find it interesting that such a script would require PHP to have safe mode off to work properly. Usually th problem with safe mode is that it restricts uploading files. But that is irrelevent here. Must be something to do with permissions and how the author of that script set things up. Anyway, not to harp on about it but that is strange that for the purpose of the scripts, safe mode matters.

    Anyway, what this guy is suggesting is to run the scripts as CGI rather than through the the php module loaded into Apache. For this to work, your web host needs to have a php binary available problably somewhere such as /usr/local/bin/php

    To run the scripts as cgi (and assuming your host supports cgi) you would change the file extension from *.php to *.cgi

    Next, in each of the scripts you would add a line to the very begining of the script which tells the shell where to find the binary to process the script. So each of your scripts will end up looking like
    PHP Code:
    #!/usr/local/bin/php
    <?php
    You would use the path to the php binary as given by your host.

    May I also say, that what you want to do is actually quite easy using php. (without all this mucking about with CGI too). If you are keen to learn php and mysql - this would be a good first project. In fact, forwarding/redirection scripts have been discussed often in the past. you could do an advanced search of the forums and you would get some code and ideas. As a hint, on shared virtual hosting accounts this can be done a couple of ways - either by using ReWrite Rules in a .htaccess file (if your host has mod_rewrite installed and you are allowed to over-ride using .htaccess). Or, a simple kludge is to use a script inside a 404 Error Document that does the redirection. Some of the scripts out their use the 404 Error Doc trick - such as http://www.go2cgi.com/cgi-bin/go.pl?/phpredirect/

    As for good sites for beginners, look at the link in my signature for Skunk's list. Good luck.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •