Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i need to upgrade php from 5.1.6 to 5.3.3 (newest).

problem is that someone else made installation of 5.1.6 and i don't have any kind of documentation about it.

so, first thing i checked was phpinfo. on that page on conigure section i found few things that makes me confused:

--without-mysql

mysql is enabled and it works fine. how is mysql enabled if it is compiled without mysql, and why?

also, there is

--with-apxs2=/usr/sbin/apxs

i'm sure that there is no apxs in /usr/sbin directory.

how was that compiled? was it installed using yum?

tnx in advance!

UPDATE: i will give you full configure section from phpinfo() function:

'./configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/usr/share/file/magic.mime' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'
share|improve this question

2 Answers 2

up vote 0 down vote accepted

Short answer - Features like MySQL and PHP can be added into the core compiled program, or loaded dynamically like a plugin.

To check if it's installed via yum [or RPM] do

 rpm -qa | grep php*
 yum list installed php

To see if your PHP is statically compiled or dynamically loaded check your /etc/httpd/conf/httpd.conf file for a LoadModule directive with a filename next to it say php along with a .so extension [likely libphp5.so]. If you see this your install is dynamic. Which means you can probably do the copy paste below [at your own risk.]


Extensions to PHP [and Apache] can happen in two ways. One way is to statically compile them into PHP [also holds for Apache.] When you statically compile it into PHP [or Apache] it is part of the compiled code.

The other is via what we call a DSO [Dynamic Shared Object], which in this context is like a plugin.

The configure options simply deal with static complilation phase. Many mainstream features like MySQL or PHP can be statically compiled or implemented as a shared object.


If PHP was statically compiled in then it's a bit complicated to upgrade. You need to recompile Apache with the new PHP in it.

If you want to upgrade your existing install with a compile from source and your install uses the dynamic version which I believe is the default method of doing things, and the most popular. download the PHP version you want. Untar it, then go into the directory and copy paste the configure line you put above and run it. Then run make && make install.

wget [link to new PHP version]
tar -xvf [file downloaded above use the "ls" command if your not sure what it is]
cd [directory created again use "ls" if not sure]
[configure command from above goes here]
make && make install

Heres a possible copy-paste version. Untested. Use at own risk.

cd /tmp
wget http://us.php.net/get/php-5.3.3.tar.gz/from/this/mirror
tar -xvf php-5.3.3.tar.gz
cd php-5.3.3
./configure '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/usr/share/file/magic.mime' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'
make && make install

For information on DSO vs Static linking check out http://ez.no/developer/blog/php_as_dso_or_as_static_php_module.

The difference is basically a trade-off in memory vs. speed.

If you keep the above compile of PHP without mysql you will need the php-mysql package [which you most likely already have.]

yum install php-mysql
share|improve this answer

If you've used packages it's possible that the features do not exactly match the compile options.

That can happen when those modules got compiled as a shared library (--with-feature=/dir,shared)

share|improve this answer
    
hmmm, not sure... can you please check updated part of my message? it contains full configure part from phpinfo. –  user48058 Aug 24 '10 at 9:20
1  
MySQL could be loaded as a shared extension. Look in your PHP ini file (path is given in phpinfo() ). --with-apxs2 will cause an Apache handler to be created during compile time. It does not have to exist on your system. –  Lekensteyn Aug 24 '10 at 10:18
    
what will be your advice, how to compile php? which of the options to define in configuration? –  user48058 Aug 24 '10 at 13:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.