SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Addict isuru's Avatar
    Join Date
    Nov 2000
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I heard that there are two "versions" of php: one is a CGI module and (I don't know the other one ) ?


    how do they differ and is one better than the other?
    Also can they both be used on Windows 98

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One is the CGI like you say, the other is a SAPI module that works like it were compiled directly into the web server hence you need a different SAPI for diffent web servers.

    I currently use the Apache SAPI module on Windows and have had no problems with it, I used to run the CGI version and had no problems with that either (Other than the odd bug when using CVS copies etc.).
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Zealot HotDog's Avatar
    Join Date
    May 2000
    Location
    Salt Lake City, UT
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I may be wrong, but I think the main difference is that when you use use the CGI mode of PHP, every time you access the PHP server, it must open the php.exe file...run the program...then shut down. Where the SAPI mode runs all the time on the server so there is no start/stop of the php.exe file.

    I know that this is how most CGI servers work (ie perl and C++ ect). The main problem with this is that it can bog down the server if it is getting several hits. Where as the SAPI mode doesn't have this problem.

    Now as I said...I don't know if this is correct or not with PHP CGI. You may want to ask a higher authority than me.

    I do know that the SAPI is the perfered mode to run PHP.
    Joe Eliason
    Just a dog learnin' PHP from cat.

  4. #4
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One more comment on this: On Windows 98, using the precompiled version of Apache, and the PHP CGI, there are a couple bugs.. One of which is that the environment variable SCRIPT_NAME actually refers to the php.exe file, and the said file freezes every time you use it. Has anyone else had this problem? I was using the firepages.au precompiled kit when this happened. I then re-installed Apache on my own, the got PHP and used the SAPI module for Apache, and it works fine as well (as well as mysql and all that...).
    Also, both versions worked great in PWS 4.0, so I think you should be fine.

    ISURU: You might want to get the afore-mentioned firepages.au precompiled version, but if I were you, I would get the 1.0 (less junk, more stable) version instead of 2.0 (where they basically compiled in every module in cyberspace).

    Good Luck with your PHP!!!
    P.S: did anyone ever see that BBSpot article: Student suspended over suspected use of PHP? check out http://www.bbspot.com it's pretty cool lots of geek humor

    ... what's the world coming to?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What are the necessary alterations I need to make to httpd.conf if I want to switch to the SAPI module from CGI mode? I'm running Windows 2000.
    "Some people play hard to get - I play hard to want."

  6. #6
    SitePoint Zealot HotDog's Avatar
    Join Date
    May 2000
    Location
    Salt Lake City, UT
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The readme.txt file that comes with the php download tells you what you need to do. Here is a clip from the readme file for installing SAPI with the IIS server running:

    IIS 4.0+ (isapi):
    1. Copy the php.ini-dist to your systemroot (the directory where you installed windows), rename it to php.ini, and
    edit it to fit your needs
    2. Start the Microsoft Management Console or the Internet Services Manager, located in your Control Panel
    3. Click on your webserver, and select properties
    4. If you don't want to perform HTTP Authentication using PHP, you can (and should) skip this step. Under ISAPI Filters,
    add a new ISAPI filter. Use PHP as the filter name, and supply a path to the php4isapi.dll
    5. Under Home Directory, click on the Configuration button. Add a new entry to the Application Mappings. Use the path the
    php4isapi.dll as the Executable, supply .php as the extension, leave Method exclusions, blank, and check the Script engine
    checkbox
    6. Stop IIS completely
    7. Start IIS again


    On my server I have C:\PHP\sapi\php4isapi.dll as the path. Also in the Application Mappings I have setup executable extensions .php .phtml and .php3 as extensions to execute the C:\PHP\sapi\php4isapi.dll module.

    Try this out. If you need more assistance, just give another post with the specific problems you are having.
    Joe Eliason
    Just a dog learnin' PHP from cat.

  7. #7
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Joe that way is perfect for IIS but Rickard is running Apache(I know this from the comment about the httpd.conf)


    Rickard since you are running Apache there is a slightly different approach to making it work and it can be quite testy. I have discovered a foolp[roof way to get it working though so have no fear.

    Follow these instructions to a tee and make sure to add the paths to your system environment, just read this:

    http://shanx.com/php/install_win32.txt
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  8. #8
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot! It seems to be working just fine. How can I determine whether I am really running the SAPI module or not? I did a phpinfo(), but it doesn't appear to list that info.
    "Some people play hard to get - I play hard to want."

  9. #9
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does it say for Server API the third directive down when you run phpinfo();?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  10. #10
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It simply sais Apache.

    I commented out two lines in http.conf:

    # Action application/x-httpd-php /php4/php.exe
    and
    # ScriptAlias /php4/ "D:/Program Files/PHP 4.0.4 pl1/"

    I think I added those two lines when I installed PHP in CGI mode, but I am not sure. The server api variable, however, doesn't change when I do this.
    "Some people play hard to get - I play hard to want."

  11. #11
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it just says Apache then you got it working with SAPI if you were to have it in CGI mode you would see CGI there.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  12. #12
    SitePoint Enthusiast
    Join Date
    Jan 2001
    Location
    Helsingborg, Sweden
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, great! Thanks again.
    "Some people play hard to get - I play hard to want."

  13. #13
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    is this discussion based on winblows for some reason ?

    /me normally doesnt see PHP accompanying windows based machines

    oh welll . .i'm going back into hiding
    cogito, ergo sum

  14. #14
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe just a post for us oddballs who need to develop, and who are lazy/dont know how to compile everything ourselves (at least thats what i am .. i dunno about any1 else.)

    ... what's the world coming to?

  15. #15
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by FatPiper
    hehe just a post for us oddballs who need to develop, and who are lazy/dont know how to compile everything ourselves (at least thats what i am .. i dunno about any1 else.)
    well, i thought thats what cheap accounts with webhosts were for ... i never bothered "developing" on a winblows machine where I feel PHP's capabilities get crippled ..

    winblows is the best example of how NOT to implement the abstract gui type (AGT) ...

    i made that one up on the fly

    http://www.linux.com http://www.linux-mandrake.com http://www.redhat.com http://www.freebsd.org http://www.debian.org http://www.freshmeat.net

    hey, i gotta put in my *nix ads .. need to recruit more of my kind ...

    all humans, welcome to the opensource generation: world domination through world cooperation

    -----------------------------
    i think i'm paranoid
    cogito, ergo sum

  16. #16
    SitePoint Addict
    Join Date
    Nov 2000
    Location
    London, UK
    Posts
    223
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh don't worry about that its not at all that I don't agree with open source, matter of fact that's were I get all my software (yes I run a Unix emu on winblows) and I use the gimp and blender etc. it's just that last time I tried to install linux, my HD got screwed and now 3 gigs have dissapeared into the ether.....

    ... what's the world coming to?


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
  •