Apache + php4 + cgi_php5

Discussion in 'Server Operation' started by ColdDoT, Aug 9, 2006.

  1. ColdDoT

    ColdDoT Member

    Hello

    i have setted up a long time ago a server with php4 and php5 at the same time php5 as cgi.
    if you go to blablabla.php it wil be parsed trough php4 is you use blablabla.php5 then it will be parsed by php5.

    the prob is every function that uses fopen kind of things, it will not run on php4 and it will run on php5, examples
    SOLUTION WAS FOUND
    (no it isn't the allow fopen config in server.ini)

    the code behind the script test.php(5) (both files have the same script)
    Code:
    <?
    $site = file_get_contents("http://www.colddot.nl/awstats/awstats.pl?month=".date("m")."&year=".date("Y")."&output=main&config=www.colddot.nl&framename=mainright");
    preg_match_all('#<b>(.*?MB|GB|KB|Bytes)<\/b>#i',$site, $gb2);
    
    $traffic = preg_replace("#(.*)<b>#","",$gb2[1][0]);
    $traffic2 = preg_replace("#(.*)<b>#","",$gb2[1][1]);
    echo $traffic+$traffic2."<br>";
    ?>
    Greets ColdDoT

    //EDIT SOLUTION
    i was working on php 4.4.2 so i upgraded to 4.4.3 and my prob was gone ;)
     
    Last edited: Aug 13, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you also try

    Code:
    <?[B][COLOR="Red"]php[/COLOR][/B]
    $site = file_get_contents("http://www.colddot.nl/awstats/awstats.pl?month=".date("m")."&year=".date("Y")."&output=main&config=www.colddot.nl&framename=mainright");
    preg_match_all('#<b>(.*?MB|GB|KB|Bytes)<\/b>#i',$site, $gb2);
    
    $traffic = preg_replace("#(.*)<b>#","",$gb2[1][0]);
    $traffic2 = preg_replace("#(.*)<b>#","",$gb2[1][1]);
    echo $traffic+$traffic2."<br>";
    ?>
    Maybe you didn't allow short open tags for PHP4.
     
  3. ColdDoT

    ColdDoT Member

    I've tested it. nop diden't work :(

    i can write verry complicated scripts on php4 i can scan dirs etc but at te moment i do it using the http:// or ftp:// it will send wrong headers or something like that.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What about this?

    on http://de.php.net/manual/en/function.file-get-contents.php ?

    PHP4 and PHP5 use different php.ini files on your setup, maybe that's the reason. Maybe some wrong setting in the php.ini for PHP4?
     
  5. ColdDoT

    ColdDoT Member

    I have taken the ini out of php tar (php.ini-recomment)
    i have enabled the follow extensions, maybe that causus problems.

    (just below top
    PHP:
    )
    [
    CODE]zend_extension_ts=/var/server/webserver/apache2/ioncube/ioncube4.so
    zend_extension_ts
    =/var/server/webserver/apache2/zend/ZendOptimizer4.so
    zend_optimizer
    .optimization_level=15
    [/CODE]

    added to the extensions list
    [
    CODE]extension=zip.so
    extension
    =rpmreader.so
    extension
    =id3.so
    extension
    =lzf.so
    extension
    =bz2.so
    extension
    =fileinfo.so
    [/CODE]

    can that causus the prob

    //EDIT
    tested by commenting it out (uncommeningwith ';'
    no diffrents

    //EDIT SOLUTION
    i was working on php 4.4.2 so i upgraded to 4.4.3 and my prob was gone ;)
     
    Last edited: Aug 13, 2006

Share This Page