Created
March 23, 2010 20:00
-
-
Save chrisforrette/341574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPILE SECONDARY VERSIONS OF PHP | |
THIS IS USING PHP 5.2 AS AN EXAMPLE | |
1. Back up original libphp5.so: | |
cd /usr/libexec/apache2 | |
sudo cp libphp5.so libphp5.so.bak | |
2. Create a version-specific config directory for php.ini | |
sudo mkdir /etc/php52 | |
3. Configure that shit | |
export MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" | |
./configure --prefix=/usr/local/php52 --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc/php52 --with-config-file-path=/etc/php52 --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 --with-curl --enable-soap --with-pcre-regex --with-kerberos --enable-bcmath --with-ldap --with-ldap-sasl --with-snmp --with-xmlrpc --with-xsl | |
4. Modify Makefile | |
mate Makefile | |
find 'EXTRA_LIBS' line, something like: EXTRA_LIBS = -lmysqlclient -lssl -lcrypto -lz -lssl -lcrypto -lm -lxml2 -lz -licucore ... | |
add ' -lresolv' to the end | |
5. Compile | |
make | |
sudo make install | |
6. Copy newly generated libphp5.so to libphp52.so | |
cd /usr/libexec/apache2 | |
sudo cp libphp5.so libphp52.so | |
7 Copy backed up libphp5.so back to where it was | |
sudo cp libphp5.so.bak libphp5.so | |
8. Update httpd.conf | |
mate /private/etc/apache2/httpd.conf | |
find 'php5_module' | |
Add line: LoadModule php5_module libexec/apache2/libphp52.so | |
Comment out whichever you don't want to use | |
9. Copy php.ini.default into php52 conf directory, make any edits you'd like | |
sudo cp /etc/php.ini.default /etc/php52/php.ini | |
10. Restart Apache | |
sudo apachectl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment