[solved] Compile PHP 5.2

Discussion in 'Install/Configuration' started by Alfa-Host, Apr 10, 2013.

  1. Alfa-Host

    Alfa-Host New Member

    Hello,

    while compiling PHP 5.2.17 i get this error :
    /bin/sh /usr/local/lsws/phpbuild/php-5.2.17/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/dom/ -I/usr/local/lsws/phpbuild/php-5.2.17/ext/dom/ -DPHP_ATOM_INC -I/usr/local/lsws/phpbuild/php-5.2.17/include -I/usr/local/lsws/phpbuild/php-5.2.17/main -I/usr/local/lsws/phpbuild/php-5.2.17 -I/usr/local/lsws/phpbuild/php-5.2.17/ext/date/lib -I/opt/xml2/include/libxml2 -I/opt/pcre/include -I/opt/curlssl//include -I/usr/include/freetype2 -I/opt/php_with_imap_client//include -I/usr/local/lsws/phpbuild/php-5.2.17/ext/mbstring/oniguruma -I/usr/local/lsws/phpbuild/php-5.2.17/ext/mbstring/libmbfl -I/usr/local/lsws/phpbuild/php-5.2.17/ext/mbstring/libmbfl/mbfl -I/opt/libmcrypt//include -I/usr/include/mysql -I/opt/xslt/include -I/opt/xslt//include -I/usr/local/lsws/phpbuild/php-5.2.17/TSRM-I/usr/local/lsws/phpbuild/php-5.2.17/Zend -I/usr/include -g -O2 -c /usr/local/lsws/phpbuild/php-5.2.17/ext/dom/node.c -o ext/dom/node.lo
    /usr/local/lsws/phpbuild/php-5.2.17/ext/dom/node.c: In function ?dom_canonicalization?:
    /usr/local/lsws/phpbuild/php-5.2.17/ext/dom/node.c:1953: error: dereferencing pointer to incomplete type
    /usr/local/lsws/phpbuild/php-5.2.17/ext/dom/node.c:1955: error: dereferencing pointer to incomplete type
    make: *** [ext/dom/node.lo] Error 1
    **ERROR** Could not compile PHP

    Thanks.
    Last edited by a moderator: Apr 12, 2013
  2. NiteWave

    NiteWave Administrator

    I searched out a similar post:
    http://forums.cpanel.net/f5/php-copile-error-305651-print.html
    hope it helps.

    I'd quote the last post:
    "Is that on cPanel ? If yes, Why don't you use easyapache ?"

    as suggested by the thread, it may need a php patch.
    in this case, building the PHP with easyApache is the best choice, since cPanel manage various php patches well.

    then, build matching php for lsws.
  3. Alfa-Host

    Alfa-Host New Member

  4. NiteWave

    NiteWave Administrator

    Thanks, this thread should be a good reference for later search.
  5. pardis

    pardis Member

    How Can use above Patch to resolve this issue ?
  6. webizen

    webizen New Member

    here is how (take php 5.4.5 source as example).

    Last edited: Jul 29, 2013
  7. xrampage16

    xrampage16 New Member

    Issue with building from WHM Plugin

    While I can apply the patch from command line, and run the configure command, make, and make install with everything going through, using the litespeed admin console, or the lsapi plugin with WHM, I am unable to apply the patch. I have been looking through various means to allow me to interject the script to apply the patch between the configure section and when it runs the Makefile, but am so far unable to. The configure command also deletes all of the old files, so applying the patch after the error is thrown, still results in...

    /home/cpeasyapache/ls.src/php-5.2.17/ext/dom/node.c:1953: error: dereferencing pointer to incomplete type
    /home/cpeasyapache/ls.src/php-5.2.17/ext/dom/node.c:1955: error: dereferencing pointer to incomplete type
    make: *** [ext/dom/node.lo] Error 1

    I am running WHM 11.38.2 (build 1). I have just a recent compile of easyapache, to add in a new library for one of my clients, which is how I came across this error.

    I have successfully compiled php using the LSAPI process before without issues.

    I have tried compiled php 5.2.17 using the following methods
    -WHM LSWS plugin, selecting the option to Compile php from LSAPI
    -Compile PHP option from Admin Console of LSWS
    -Running the following line via commandline "php /usr/local/cpanel/whostmgr/docroot/cgi/lsws/cmd_buildmatchingphp.php"

    All of them result in the same error.
    Last edited: Aug 14, 2013
  8. xrampage16

    xrampage16 New Member

    Found a working solution

    After working on it all day, and deciding to finally ask on the forum, I came across the solution that I was looking for.

    http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi

    That url provides instructions on how to perform the install completely via command line. I was able to skip a few steps, since all of the files were downloaded and ready to go.

    I simply had to do the following...
    #cd /home/cpeasyapache/ls.src/php-5.2.17
    #./configure '--prefix=/lsphp5' '--with-litespeed' --with-mysql ... (add your configuration here, which you can obtain from easyapache via "php -i" from ssh)
    #wget https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
    #patch -p0 -b < txtbgxGXAvz4N.txt
    #make
    #make install

    With that, the error should not display. If, for any reason, you need to run ./configure again, the php-5.2.17 directory will be wiped, and you will need to download the patch again.

    After that, you simple need to update your symbolic link at /usr/local/lsws/fcgi-bin/lsphp5 to your new php build, and you should be good to go.

    I recommend that if your /usr/local/lsws/fcgi-bin/lsphp5 file is not a symbolic link, that you make a copy of it, in case you have php errors. In the litespeed admin, I added a test external app to make sure that it works with my clients, before changing it, just in case (otherwise your clients will all receive 503 errors)

    Hope this helps other out there with similar issues

Share This Page