The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP 5.2.3 Issues

Discussion in 'General Discussion' started by jdhf99, Jun 16, 2007.

  1. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Hey,

    I'm having some issues with PHP 5.2.3 that I need some help with.

    I have been attempting to manually upgrade PHP on a server that, as of right now, has PHP 5.2.1. (WHM, from what I see, only has up to version 5.2.1? I think.)

    When I configure/make/make install PHP 5.2.3, every PHP page on the server gives an HTTP 500 error. In Apache's error_log I see these errors:

    Code:
    [Sat Jun 16 18:10:28 2007] [error] [client x.x.x.x] malformed header from script. Bad header=<?xml version="1.0" encoding=": /home/juan/public_html/radioblog/BelindaStyle/playlist.php
    [Sat Jun 16 18:10:28 2007] [error] [client x.x.x.x] File15] malformed header from script. Bad header=<table width="400px" border="0: /home/samurais/public_html/pruebas/crear_noticia.php
    [Sat Jun 16 18:10:29 2007] [error] [client x.x.x.x] malformed header from script. Bad header=<head>: /home/webera/public_html/index.php
    [Sat Jun 16 18:10:30 2007] [error] [client x.x.x.x] malformed header from script. Bad header=  <head>: /home/itech/public_html/index.php
    [Sat Jun 16 18:10:30 2007] [error] [client x.x.x.x] malformed header from script. Bad header=  <head>: /home/enoyx/public_html/deathnote/index.php
    [Sat Jun 16 18:10:31 2007] [error] [client x.x.x.x] malformed header from script. Bad header=  <head>: /home/enoyx/public_html/deathnote/index.php
    The configure line I use for PHP (Which works fine with 5.2.1) is:
    Code:
    ./configure --prefix=/usr --with-xml --enable-bcmath --enable-calendar --with-curl --enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 --with-gettext --enable-magic-quotes --with-mysqli --with-mysql=/usr --enable-discard-path --with-pear --enable-sockets --enable-track-vars --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --with-zlib
    I've this noticed in PHP 5.2.3's changelog:
    PHP is installed as CGI. The only thing I can think of is something with that change to php-cgi, but I do not know. When I revert back to 5.2.1 from 5.2.3 the 500 errors stop.

    Does anyone have any ideas as to what is wrong?

    Server's OS is CentOS 4.5 and is using Apache version 1.3.37.

    Thanks for your time.
     
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Try doing:

    ln -s /usr/bin/php-cgi /usr/bin/php

    or

    cp /usr/bin/php-cgi /usr/bin/php

    You may already have a php binary in that directory so you may need to rename it:

    mv /usr/bin/php /usr/bin/php.old

    Not sure if this will work, but would be interested to know if it does.
     
  3. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    That worked.

    I thought about doing that, but wasn't sure. I wasn't sure if /usr/bin/php was PHP's "CLI version" while /usr/bin/php-cgi was the "CGI version for Apache", so I didn't do it thinking that I would break something.

    I'm wondering a little now if that will have any negative effects, but so far it's looking good.

    Thank you. :)
     
  4. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,384
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    You can always tell by doing:

    php -v

    or

    /usr/bin/php -v

    that should tell you whether the binary is a CGI compiled binary or the CLI compiled binary.

    I believe, though I am not sure, I believe easyapache will compile a CLI version in /usr/local/bin and if phpsuexec is being used then it compiles a CGI binary in /usr/bin although I can't be sure.
     
  5. jdhf99

    jdhf99 Well-Known Member

    Joined:
    Mar 16, 2004
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    6
    Yeah, I should have known that.

    The reason that I was doing this manually was because I wanted to patch PHP with Suhosin and use the Suhosin extension, which I do not think you can add in through WHM's 'easyapache' thing. (Yet? I didn't see it, I may be wrong?)

    I've been able to easily compile/patch PHP before with Suhosin on cPanel servers, but ever since version 5.2.3 I've been having problems with that php binary as cgi change.

    cPanel was updated on one of the servers earlier tonight, so I used the 'easyapache' thing to upgrade PHP to 5.2.3, then I manually recompiled it with Suhosin and it worked fine. It looks like PHP was installed as an 'Apache 2.0 Handler' instead of CGI from the upgrade through WHM, so I didn't have the same issue as before, I believe.

    Again, thank you for the help and suggestions.
     
    #5 jdhf99, Jun 17, 2007
    Last edited: Jun 17, 2007
  6. Pda0

    Pda0 Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    70
    Likes Received:
    0
    Trophy Points:
    6
    Had the same problem with vanilla easyapache update.

    The fix worked, thanks (Wonder why easyapache didn't fix it automatically though)

    .pd
     
  7. flashweb

    flashweb Well-Known Member

    Joined:
    Mar 13, 2003
    Messages:
    243
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    On fresh cpanel install, sites use php-cgi

    But on server with php upgrade, sites still use /usr/bin/php

    Where do i tell sites to use php-cgi ?
     
  8. flashweb

    flashweb Well-Known Member

    Joined:
    Mar 13, 2003
    Messages:
    243
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    I have upgraded PHP on a server and site stoped working.

    I got the problem fixed as per sparek-3 post.

    But /usr/bin/php is not cgi only (not cli).

    I have same version of PHP on another server (fresh install of cpanel, on that sites works fine with /usr/bin/php running as CLI). I need CLI support for some scripts.


    Why /usr/bin/php in CLI mode works fine with fresh cpanel install and not when upgrading PHP ?

    Is there any way i can keep /usr/bin/php in CLI, still get the sites working ?

    Thanks,

    Yujin
     
Loading...

Share This Page