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

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0
    I work with web sites that use Apache SSI (server side include) statements extensively to generate page headers and navigation. Sometimes the includes nest up to five pages deep. (They consist of mainly if statements and other includes).

    I'm programming a new site from the ground up over the next week and I expect to be using PHP for database queries and dynamic pages in the future. So I'd like to use PHP from the ground up so I can plug in these features later.

    My question is: If I use PHP statements to perform simple SSI tasks that I'm used to using, will the performance of my site
    benefit or suffer? Should I stick to SSI and simply use PHP virtual() commands to include headers/footers?

    Thanks in advance.
  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
    62
    I am sure that the PHP include() or require() method is much faster than the SSI, method, as well as being more flexible.

    This will be especially true if you are using the Zend optimizer.

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    2
    Rep Power
    0
    A guy helped me out on another forum and sent me these benchmark results:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
    Apache includes a benchmarking utility (ab) that might be informative. I ran a test on my several-years-old K6-300 with 10,000 iterations of an HTTP fetch. The file included four references to a small text file. Here are the results:

    virtual() 66.756 seconds

    readfile() 57.146 seconds

    ssi #include 44.377 seconds [/quote]

    This was performed with PHP3. Can I expect better results with PHP4? I remeber reading benchmarks somwhere commenting that PHP4 with Zend renders dynamic pages almost as fast as Apache serves static HTML.

    Any comments?

    [This message has been edited by morden (edited July 25, 2000).]
  6. #4
  7. No Profile Picture
    Gödelian monster
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 1999
    Location
    Central Florida, USA
    Posts
    2,307
    Rep Power
    62
    Well, yes, hehe...

    1. The virtual() method is just a way for PHP to call the Apache SSI include function, so now you are parsing the request twice. Of course it will be slower.

    2. readfile() lets PHP perform a 'console' type operation; reading a file and returning it to the standard output, which may be useful at times, but is certainly not the most efficient way to include content.

    As I said, the PHP include() or require() functions are what you want to research.
    http://www.php.net/manual/function.require.php
    http://www.php.net/manual/function.include.php

    For most of your needs, you would probably want require(), since it evaluates only once, whether it's placed multiple time on a page or not. It definitely beats SSI for speed and functionality (try to include a page from somewhere else on the web). In fact, I'm willing to bet that with require() and PHP4/Zend, on a large website you would actually see a speed INCREASE over serving completely static pages, since you reduce disk I/O.

Similar Threads

  1. Replies: 2
    Last Post: August 18th, 2004, 10:45 PM
  2. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 01:14 PM
  3. Free Hosting 100 MB, PHP, CGI, SSI, File Manager
    By idleserv in forum Free Web Hosting
    Replies: 1
    Last Post: January 18th, 2004, 08:12 PM
  4. Passing string from PHP to Javascript
    By ka8oad in forum JavaScript Development
    Replies: 4
    Last Post: January 17th, 2004, 03:12 PM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo