2

I have already installed Apache 2.2.14, PHP 5.3.1 (using mod_fastcgi) and MySQL 5.1.41 - this is working great, but I am now trying to install PHP 5.2.6 (also using mod_fastcgi) so I can use it for testing on other virtualhosts as my host uses this version.

I followed the same procedure in CentOS 5, and earlier versions of Fedora, and it worked fine. I have installed all the dependencies I need. "configure" worked fine, here is my configure command...

./configure \
--prefix=/usr/local/php-5.2.6 \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-curlwrappers \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-imagick \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-ldap \
--enable-libxml \
--enable-mbstring \
--with-mcrypt \
--with-mhash \
--with-mysql \
--with-mysqli \
--with-openssl \
--enable-pdo \
--with-pdo-mysql \
--enable-soap \
--enable-sockets \
--with-tidy \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-zlib

But I seem to be getting errors when running "make"... there are alot of errors so I have shown the first and last bit (had to log it to a text file it was so long). I assume I need some compile flags/options to get this to work.

/bin/sh /home/luke/Downloads/php-5.2.6/libtool --silent --preserve-dup-deps --mode=compile gcc  -Iext/libxml/ -I/home/luke/Downloads/php-5.2.6/ext/libxml/ -DPHP_ATOM_INC -I/home/luke/Downloads/php-5.2.6/include -I/home/luke/Downloads/php-5.2.6/main -I/home/luke/Downloads/php-5.2.6 -I/usr/include/libxml2 -I/home/luke/Downloads/php-5.2.6/ext/date/lib -I/usr/include/ImageMagick -I/usr/include/imap -I/home/luke/Downloads/php-5.2.6/ext/mbstring/oniguruma -I/home/luke/Downloads/php-5.2.6/ext/mbstring/libmbfl -I/home/luke/Downloads/php-5.2.6/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/home/luke/Downloads/php-5.2.6/TSRM -I/home/luke/Downloads/php-5.2.6/Zend    -I/usr/include -g -O2  -c /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c -o ext/libxml/libxml.lo 
In file included from /home/luke/Downloads/php-5.2.6/Zend/zend.h:236,
from /home/luke/Downloads/php-5.2.6/main/php.h:34,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:34: error: expected specifier-qualifier-list before 'uint'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:41: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'char'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:43: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_alloc.h:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'[/code]

...

/home/luke/Downloads/php-5.2.6/Zend/zend_hash.h:339: note: previous implicit declaration of 'strtol' was here
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:234,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/snprintf.h:82: error: expected declaration specifiers or '...' before 'va_list'
/home/luke/Downloads/php-5.2.6/main/snprintf.h:84: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:236,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/spprintf.h:42: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php.h:293: error: expected declaration specifiers or '...' before 'va_list'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:383,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_output.h:100: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'extern'
In file included from /home/luke/Downloads/php-5.2.6/main/fopen_wrappers.h:25,
from /home/luke/Downloads/php-5.2.6/main/php.h:401,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_globals.h:33: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'struct'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:405,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/TSRM/tsrm_virtual_cwd.h:162: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:407,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:60: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:62: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
/home/luke/Downloads/php-5.2.6/Zend/zend_constants.h:64: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
In file included from /home/luke/Downloads/php-5.2.6/main/php.h:414,
from /home/luke/Downloads/php-5.2.6/ext/libxml/libxml.c:28:
/home/luke/Downloads/php-5.2.6/main/php_reentrancy.h:57: error: expected ')' before '*' token
make: *** [ext/libxml/libxml.lo] Error 1

I have tried several times now, deleting the folder and files and starting from scratch with a fresh download, still the same ****. I'm sure I've seen this error before but I just can't remember what I did as I always forget to write things down - I usually find hours of frustration is solved by something silly. I got PHP 5.2.12 to compile fine, but ideally I would like to use PHP 5.2.6 to emulate the web host's environment.

I'm not sure if this will help you help me.

[root@localhost php-5.2.6]# gcc -v
Using built-in specs.
Target: i686-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch=i686 --build=i686-redhat-linux
Thread model: posix
gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)

Do I need to provide any more information that could help?

  • Have you looked at the configure log? Sometimes there are errors with the configuration that can cause compilation errors. – Catherine MacInnes Dec 30 '09 at 15:56
  • Just had a look, but it's a huge file and most of it eludes me. There isn't anything that appears to shed any light on why this wont make. I wonder if it is because I need to pass some compile settings to it somehow, or install compatibility libraries/headers/packages for it to use instead. I'm just totally stumped. – Luke Armstrong Dec 30 '09 at 22:23

3 Answers3

0

Make sure that you run

phpize

before any ./configure script (this includes other extensions for PHP).

kenorb
  • 5,943
  • 1
  • 44
  • 53
0

The short answer is that the older PHP version probably does something dumb that GCC 4.4 can't handle.

Try installing gcc 4.3 and then using:

CC=gcc-4.3 make
LapTop006
  • 6,466
  • 19
  • 26
  • Thanks for this, I will give 4.3.4 a try. I found this article to help me do it. http://www.mjmwired.net/resources/mjm-fedora-gcc.html – Luke Armstrong Dec 31 '09 at 16:48
  • Well when compiling with 4.3.4 it only moans about errors with openssl, even if I configure it with [--with-openssl=/usr] or just [--with-openssl]. I'm sick of this, I've wasted days of time trying to prepare a testing enviroment the same as my host and I would be better off just developing and testing with php 5.3.1 doing another bout of testing directly on my host. Thanks for the help anyway. – Luke Armstrong Dec 31 '09 at 23:26
  • I noticed I had version 1.0.0-beta4 of openssl installed. So I decided to install the latest stable 0.9.x of openssl and use that in the configure command. It has finally compiled successfully, but now I need to get it to work with fastcgi without timing out. – Luke Armstrong Jan 01 '10 at 00:08
0

Careful, don't make the same mistake I did!

With PHP 5.2 it appears I have to also use these configure options [--enable-fastcgi] and [--enable-force-cgi-redirect] for it to work with mod_fastcgi. If you don't use those options with PHP 5.2 you will just get a server 500 error and an unhelpful error message in the error.log!

For some reason PHP 5.3 doesn't have those options, and I based my ./configure options for 5.2 on the ones I used for 5.3.

Thanks for your help LapTop006, when I find time I need to write all this down in a tutorial.