Ω Security Update 2012-004 Server (Snow Leopard) is not PHP Neutral

|

This update is not PHP-neutral. Apple installs PHP 5.3.15 over your custom PHP installation.

I looked at the configure that Apple uses and it looks about like our usual configure info, save for a few options (see below).

So the steps required to make this all work with what we have from our previous expeditions, except this time I decided to try a 5.4.8 installation, which should keep us ahead of Apple for quite some time:

  1. Keep copies of the Apple binaries and how they configured their installation:

    $ php -i > ~/php-config-2012.11.08
    $ sudo cp /usr/libexec/apache2/libphp5.so /usr/libexec/apache2/libphp5.so.old
    $ sudo cp /usr/bin/php /usr/bin/php.old
    
  2. Get the 5.4.8 tarball and unpack it.

  3. Move the libpng headers around a bit so that configure doesn’t find old headers for use with the new libraries:

    $ sudo mv /usr/X11R6/include/png.h /usr/X11R6/include/png.h_old
    
  4. Append the new flags to the configure statement and configure away:

    $ ./configure  '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-apxs2=/usr/sbin/apxs' '--enable-cli' '--with-config-file-path=/etc' '--with-libxml-dir=/usr' '--with-openssl=/usr' '--with-kerberos=/usr' '--with-zlib=/usr' '--enable-bcmath' '--with-bz2=/usr' '--enable-calendar' '--with-curl=/usr' '--enable-exif' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--enable-gd-native-ttf' '--with-ldap=/usr' '--with-ldap-sasl=/usr' '--enable-mbstring' '--enable-mbregex' '--with-mysql=mysqlnd' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-mysql-sock=/var/mysql/mysql.sock' '--with-iodbc=/usr' '--enable-shmop' '--with-snmp=/usr' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--with-xmlrpc' '--with-iconv-dir=/usr' '--with-xsl=/usr' '--with-pcre-regex' '--with-freetype-dir=/usr/X11R6' '--enable-zend-multibyte' '--enable-zip'
    

(PHP will gripe about ‘—enable-zend-multibyte’ and ‘—disable-dependency-tracking’, but I’ve left them in here so I can go back and investigate. Note that this may cause a problem—I just don’t know yet.)

  1. Use four cores to make PHP. It’s a lot faster to use the -j 4 option, and if you have more cores, make the number match:

    $ make -j 4
    
  2. Install.

    $ sudo make install
    
  3. Restart Apache.

    $ sudo apachectl restart
    
  4. Clean up what we did to the libpng headers:

    $ sudo mv /usr/X11R6/include/png.h_old /usr/X11R6/include/png.h
    

Done.

Alternatively, if you have already installed 5.4.8 before, all you need to do is:

  1. Keep copies of the Apple binaries and how they configured their installation:

    $ php -i > ~/php-config-2012.11.08
    $ sudo cp /usr/libexec/apache2/libphp5.so /usr/libexec/apache2/libphp5.so.old
    $ sudo cp /usr/bin/php /usr/bin/php.old
    
  2. Install.

    $ sudo make install
    
  3. Restart Apache.

    $ sudo apachectl restart
    

Done!

Recent Comments