Home Forums OS X Server and Client Discussion Questions and Answers Upgrading php to 5.2.11 to fix 5.2.10 date bug

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #377281
    smithsm
    Participant

    The 5.2.10 php update in secuity update 1009-05 broke my php based websites. Since this is fixed in 5.2.11, I would like
    to update PHP to 5.2.11. I have never done this for OS X Server. I can find online instructions for building php for os X
    Client such as …

    http://www.malisphoto.com/tips/php-on-os-x.html
    http://diymacserver.com/installing-php/

    But not to upgrade the apple version in os X Server. Its ok if a subsequent apple update clobbers it. I just
    want to fix the problem because my site it useless and don’t know how long it will take apple to fix it.

    Any suggestions on what’s different with the os x Server version of php and upgrading it.

    I have OSX Leopard Server 10.5.8 v1.1 on PPC

    #377343
    smithsm
    Participant

    I was able to put together a set of instructions that work for
    upgrading to php 5.2.11 on OS X Server 10.5.8 v1.1

    Here they are

    I used a combination of the following:
    Alexandrides (alex) Athanasios topic desk
    os x server instructions (for php 5.2.10)
    “Updating_PHP5_on_OS_X_Server_10_5_Leopard.rtf”
    with 5.2.11 specific instructions here
    http://www.malisphoto.com/tips/php-on-os-x.html
    along with some help from here
    http://www.bill.eccles.net/bills_words/2008/12/libiconv-madness.html

    ————–
    some directory to put sources in

    $ mkdir -p /install/source
    $ cd /install/source

    ——– MySQL client
    to see manual download go to http://www.opensource.apple.com/release/mac-os-x-1058/
    search for mysql

    $ curl -O http://www.opensource.apple.com/other/MySQL-45.binaries.tar.gz

    $ tar xzpf MySQL-45.binaries.tar.gz
    $ cd MySQL-45.binaries

    I think the MySQL-45 contains both mysql 4 and mysql 5 not mysql 4.5

    $ tar xzf MySQL-45.root.tar.gz

    make sure /usr/include and /usr/lib exist if not then create them with
    sudo mkdir -p /usr/include

    sudo mkdir -p /usr/lib

    $ sudo cp -r usr/include/mysql /usr/include/
    $ sudo cp -r usr/lib/mysql /usr/lib/
    $ sudo cp -r usr/bin/mysql_config /usr/bin/mysql_config

    —– add libiconv in /usr/local/lib but leave Apple’s in /usr/lib

    download
    http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
    copy to
    /install/source

    $ cd /usr/local

    $ pwd
    /usr/local
    $ ls
    bin

    $ sudo mkdir -p src
    $ sudo mkdir -p lib
    $ ls
    bin lib src
    $ cd /usr/local/src

    $ sudo tar -xvzpf /install/source/libiconv-1.13.1.tar.gz
    $ cd /usr/local/src/libiconv-1.13.1

    $ sudo -s

    MACOSX_DEPLOYMENT_TARGET=10.5 \
    CFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp” \
    CCFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” \
    CXXFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” \
    LDFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load” \
    ./configure

    # exit
    $ sudo make

    $ sudo make install

    ————— php

    $ curl -O http://us2.php.net/distributions/php-5.2.11.tar.gz

    $ tar xzpf php-5.2.11.tar.gz

    $ cd /install/source/php-5.2.11

    $ sh

    $ CFLAGS=-DBIND_8_COMPAT
    $ export CFLAGS

    What is that for
    http://php.net/manual/en/install.macosx.php
    The -DBIND_8_COMPAT=1 gets you over a problem in the DNS files because MacOS X has definitions for Bind9 and PHP expects Bind8 definitions. -DEAPI is needed if you build it for Apache 1.3.31. -O3 enables the gcc optimizer.

    But that if for an old version of PHP so maybe no longer needed but will keep it

    MACOSX_DEPLOYMENT_TARGET=10.5 \
    CFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp” \
    CCFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” \
    CXXFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -g -Os -pipe” \
    LDFLAGS=”-arch ppc -arch ppc64 -arch i386 -arch x86_64 -bind_at_load” \
    ./configure \
    –prefix=/usr \
    –mandir=/usr/share/man \
    –infodir=/usr/share/info \
    –with-apxs2=/usr/sbin/apxs \
    –with-ldap=/usr \
    –with-kerberos=/usr \
    –enable-cli \
    –with-zlib-dir=/usr \
    –enable-exif \
    –enable-ftp \
    –enable-mbstring \
    –enable-mbregex \
    –enable-sockets \
    –with-iodbc=/usr \
    –with-curl=/usr \
    –with-config-file-path=/etc \
    –sysconfdir=/private/etc \
    –with-mysql-sock=/var/mysql \
    –with-mysqli=/usr/bin/mysql_config \
    –with-mysql=/usr \
    –with-openssl \
    –with-xmlrpc \
    –with-xsl=/usr \
    –without-pear

    —————–
    Now have to patch makefile

    http://www.malisphoto.com/tips/php-on-os-x.html

    # Patch the make file per http://bugs.php.net/bug.php?id=48195
    # Need to do this only on 64-bit builds
    nano Makefile
    # Change the line ….
    $(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
    # to …
    $(CC) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(MH_BUNDLE_FLAGS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so

    ————

    $ make

    $ make test

    $ sudo make install

    $ sudo apachectl graceful

    $ exit

    $ /usr/bin/php -v
    PHP 5.2.11 (cli) (built: Oct 14 2009 15:19:32)
    Copyright (c) 1997-2009 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

    $ /usr/bin/php -i

    Create a file called info.php with the following contents:

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed