#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Perth, Australia
    Posts
    0
    Rep Power
    0

    Advice needed on PHP4


    Hi all,
    I'm after some quick advice, being very new to PHP development...

    I recently signed up with a web host who claimed to offer PHP4 (Zend) support for all their hosting plans. After trying out some very basic scripts it seems to me that its not PHP4 running but some other earlier version and/or a CGI version of PHP...

    They now claim that they use a PHP CGI binary to enable faster script processing and that some functions are not supported with the CGI version. Can this possibly be PHP4? or are they talking crap as I suspect?

    I tried the following scripts without any success
    (i.e. blank page & no error messages):

    <?php phpinfo(); ?>

    <?php
    $extens = get_loaded_extensions();
    foreach($entens as $each_ext)
    {
    echo "$each_ext <br><ul>";
    $ext_funcs = get_extension_funcs($each_ext);
    foreach($ext_funcs as $func)
    {
    echo "<li> $func";
    }
    echo "</ul>";
    }
    ?>

    surely these should work?

    only very basic scripts have worked so far for doing basic form processing etc.

    Thanks in advance,

    Harvey Green
  2. #2
  3. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    65
    They are talking crap.

    No one runs PHP as CGI binary for better performance. It's completely in reverse. The only way you get good performance from PHP is as an Apache module.

    The CGI version of PHP can run almost all the same functions, except (I seem to remember) some of the more esoteric ones. It definitely runs phpinfo(), etc...

    There are only two possible reasons for using a CGI: 1) you have certain security issues, which make it important for each virtual host to run CGI binaries as a different user id, or 2) you are too lazy to bother recompiling Apache, so you just compile PHP as a standalone binary for CGI execution.

    I suspect it is the latter, because if a server runs the PHP module in "safe mode", then most of those module security issues go away, along with a few CGI-specific ones.

    The simple answer to why certain functions are disabled is that they specifically disabled them in php.ini (you can enter a whole list of functions not to allow), and they turned off error_reporting, doing the users the great big favor of not being able to debug their scripts. If they use this method carefully, then it is actually pretty hard to tell whether they are using PHP3, or just have disabled many newer functions in PHP4.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    6
    Rep Power
    0
    actually the CGI Binary is generally used on an NT server because under heavy load it gives better performance than the isapi module.

    the phpinfo(); command on its own should print out a load of information, providing its not in the disabled functions list, this is due to it being a little bit of a security hazard. If it doesnt print out anything, view the page source and see whats in there, becuase you may find that its not being processed.

    if all else fails, and you are running apache as the web server try putting (or editing) a .htaccess file in the directory where you want to run the php scripts and add the directive of..

    AddType application/x-httpd-php3 .php3

    for php 3 or

    AddType application/x-httpd-php .php

    for php 4.

    again those are only ideas, not concrete work arounds.
  6. #4
  7. Advisor
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    Stockholm, Sweden
    Posts
    446
    Rep Power
    19
    Regarding the blank page & no error messages...
    This often shows up in Netscape.....IE shows them on the page...

    In Netscape ..if you choose View - Page Source..
    You sometimes can see some "hidden" errormessages....

    /Johan
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    UK
    Posts
    527
    Rep Power
    18
    sometimes browsers don't show pages if they don't have the proper <html><body> and </body></html> tags at the top and bottom. Your output will still show in the page source though.
    Doc MacGurgles Babylonian Lizard Tooth Oil worked for me
  10. #6
  11. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    65
    Yes, I had forgotten about the opening tag issue in Netscape.

    But still, it doesn't make sense that the CGI binary has higher perfomance than the ISAPI module, on NT. The whole point of ISAPI was so that server-interpreted pages could run in the webserver process, in the kernel, thus greatly increasing speed. The reason people use the CGI version of PHP on NT/2000 systems is because the ISAPI module has a few stability issues. I personally have had no problem with the ISAPI module on a Windows 2000 system, though.
    The real n-tier system:

    FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

    Amazon wishlist -- rycamor (at) gmail.com

IMN logo majestic logo threadwatch logo seochat tools logo