Compiling php 5.3

Source: php.net 5.3.0 latest stable build of 5.3 branch

./configure –prefix=/usr/local/php5
–mandir=/usr/share/man
–infodir=/usr/share/info
–sysconfdir=/etc
–with-config-file-path=/etc
–with-zlib
–with-zlib-dir=/usr
–with-openssl
–without-iconv
–enable-exif
–enable-ftp
–enable-mbstring
–enable-mbregex
–enable-sockets
–with-mysql=/usr/local/mysql
–with-pdo-mysql=/usr/local/mysql
–with-mysqli=/usr/local/mysql/bin/mysql_config
–with-apxs2=/usr/local/apache2/bin/apxs

Error:

checking libxml2 install dir… no
checking for xml2-config path…
configure: error: xml2-config not found.
Please check your libxml2 installation.

After a yum install libxml2-devel.x86_64:

configure: error: Cannot find OpenSSL’s

yum install openssl-devel [fixed it]

Found a good resource at http://www.eukhost.com/forums/f15/troubleshooting-php-installations-compilations-linux-servers-6041/

Done.

Apache Startup Script

The CentOS startup script for apache is located at /etc/init.d/httpd. I backed this file up to /home/lasota/saved/httpd_d/httpd and replaced it with:

#!/bin/bash
#
# apache
#
# chkconfig:
# description: Start up the Apache web server.
# Source function library.
. /etc/init.d/functions
RETVAL=$?
APACHE_HOME=”/usr/local/apache2/”
case “$1” in
start)
if [ -f $APACHE_HOME/bin/apachectl ]; then
echo $”Starting Apache”
$APACHE_HOME/bin/apachectl start
fi
;;
stop)
if [ -f $APACHE_HOME/bin/apachectl ]; then
echo $”Stopping Apache”
$APACHE_HOME/bin/apachectl stop
fi
;;
*)
echo $”Usage: $0 {start|stop}”
exit 1
;;
esac
exit $RETVAL

This script functions and starts the proper apache (the one I compiled from source). Question: does it survive a yum reinstall?

The startup script above does survive a

yum reinstall httpd

I wonder if some other yum update or reinstall would clobber the startup script though. I will ask Peter.

MySQL configure script error

Following the install directions for MySQL source distribution:

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf –
shell> cd mysql-VERSION
shell> ./configure -prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db –user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe –user=mysql &

I ran the configure script for MySQL. It cannot find the termcap/ncurses library. Several dozen searches later I am trying an install of ncurses-devel.

$yum install ncurses-devel.i386
$yum install ncurses-devel.x86_64

That seems to work. OK now for the make.

$make
bash: make: command not found
$whereis make
make: /usr/share/man/man1p/make.1p.gz

Make is not around or can’t be found. Hmmmn.

$yum install make.x86_64

Error:

g++ -DDEFAULT_BASEDIR=”/usr/local” -DMYSQL_DATADIR=””/usr/local/var”” – DDEFAULT_CHARSET_HOME=””/usr/local”” -DSHAREDIR=””/usr/local/share/mysql”” –
DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX –
DDEFAULT_SYSCONFDIR=””/usr/local/etc”” -DHAVE_CONFIG_H -I. -I../include -I../zlib -I../include –
I../include -I. -O -fno-implicit-templates -fno-exceptions -fno-rtti -c -o my_new.o my_new.cc
../depcomp: line 571: exec: g++: not found

Looking for g++

yum install gcc-c++

Error:

g++ -DDEFAULT_BASEDIR=”/usr/local” -DMYSQL_DATADIR=””/usr/local/var”” -DDEFAULT_CHARSET_HOME=””/usr/local”” -DSHAREDIR=””/usr/local/share/mysql”” -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=””/usr/local/etc”” -DHAVE_CONFIG_H -I. -I../include -I../zlib -I../include -I../include -I. -O -fno-implicit-templates -fno-exceptions -fno-rtti -c -o my_new.o my_new.cc ../include/my_global.h:1105: error: redeclaration of C++ built-in type ‘bool’

MySQL forums lead to advice wiping with make clean and doing a configure again. Confusion between gcc and g++ compiler.

That worked. MySQL 5.1.39 installed.