Skip to content

Instantly share code, notes, and snippets.

@0livier
Created November 15, 2012 17:27
Show Gist options
  • Save 0livier/4079937 to your computer and use it in GitHub Desktop.
Save 0livier/4079937 to your computer and use it in GitHub Desktop.
Patches and configure line to get PHP 5.1.6 compiled on Centos 6
--- /root/php-5.1.4/php-5.1.4/ext/curl/interface.c.orig 2011-08-12 11:21:54.829741804 +0200
+++ /root/php-5.1.4/php-5.1.4/ext/curl/interface.c 2011-08-12 11:22:29.026246504 +0200
@@ -266,7 +266,7 @@
REGISTER_CURL_CONSTANT(CURLOPT_FTPAPPEND);
REGISTER_CURL_CONSTANT(CURLOPT_NETRC);
REGISTER_CURL_CONSTANT(CURLOPT_FOLLOWLOCATION);
- REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
+ // REGISTER_CURL_CONSTANT(CURLOPT_FTPASCII);
REGISTER_CURL_CONSTANT(CURLOPT_PUT);
#if CURLOPT_MUTE != 0
REGISTER_CURL_CONSTANT(CURLOPT_MUTE);
@@ -306,7 +306,7 @@
REGISTER_CURL_CONSTANT(CURLOPT_FILETIME);
REGISTER_CURL_CONSTANT(CURLOPT_WRITEFUNCTION);
REGISTER_CURL_CONSTANT(CURLOPT_READFUNCTION);
- REGISTER_CURL_CONSTANT(CURLOPT_PASSWDFUNCTION);
+ // REGISTER_CURL_CONSTANT(CURLOPT_PASSWDFUNCTION);
REGISTER_CURL_CONSTANT(CURLOPT_HEADERFUNCTION);
REGISTER_CURL_CONSTANT(CURLOPT_MAXREDIRS);
REGISTER_CURL_CONSTANT(CURLOPT_MAXCONNECTS);
#!/bin/bash
VERSION=5.1.6
wget http://pecl.php.net/get/oci8 -O ext_oci8-1.4.9.tgz
rm -rf php-$VERSION /opt/app/php/$VERSION
tar xjf php-$VERSION.tar.bz2
cd php-$VERSION
patch -d ext/curl <../curl.diff
patch -d ext/openssl <../openssl.diff
./configure --prefix=/opt/app/php/$VERSION --with-apxs2=/usr/sbin/apxs --with-config-file-scan-dir=/opt/app/php/$VERSION/etc/conf.d --with-config-file-path=/opt/app/php/$VERSION/etc/php.ini --with-exec-dir=/opt/app/php/$VERSION/lib --with-pear=/opt/app/php/$VERSION/php --with-mcrypt --with-openssl --with-gd --with-xsl --with-curl -with-png-dir --with-zlib --with-zlib-dir --with-libdir=lib64 --enable-gd-native-ttf --enable-sockets --enable-exif --enable-ftp --with-iconv --with-gettext --enable-mbstring --with-t1lib=/usr --with-freetype-dir=/usr --enable-soap --with-kerberos --with-db4 --with-bz2 --with-ldap --with-sqlite --with-pdo-sqlite --with-mysql --with-mysql-sock --with-pdo-mysql
make -j 4
# make install is doing a make install-sapi, which we'll deal alone
make install-cli install-build install-headers install-programs install-pear
mkdir -p /opt/app/php/$VERSION/etc/conf.d
cp php.ini-recommended /opt/app/php/$VERSION/etc/php.ini
# Oracle
patch -d ext/pdo_oci <../pdo_oci.diff
cd ext
rm -rf oci8
tar xzfv ../../ext_oci8-1.4.9.tgz
cd oci8-1.4.9/
#cd oci8
/opt/app/php/$VERSION/bin/phpize
./configure --with-oci8=shared,instantclient --with-php-config=/opt/app/php/$VERSION/bin/php-config
make
make install && echo "extension=oci8.so" > /opt/app/php/$VERSION/etc/conf.d/oci8.ini
cd ../pdo_oci
/opt/app/php/$VERSION/bin/phpize
autoconf-213
./configure --with-pdo-oci=shared,instantclient,/usr,10.2.0.5 --with-php-config=/opt/app/php/$VERSION/bin/php-config
make
make install && echo "extension=pdo_oci.so" > /opt/app/php/$VERSION/etc/conf.d/pdo_oci.ini
# PECL extras
cd /opt/app/php/$VERSION
bin/pear config-set http_proxy http://pablo:8888
bin/pecl install xdebug && p=`find /opt/app/php/$VERSION -name 'xdebug.so'` && echo "zend_extension=\"$p\"" >etc/conf.d/xdebug.ini
bin/pecl install apc && echo "extension=apc.so" > etc/conf.d/apc.ini
bin/php -m
--- openssl.c.orig 2012-11-15 13:54:21.228464238 +0100
+++ openssl.c 2012-11-15 13:55:21.010589034 +0100
@@ -203,8 +203,8 @@
static char default_ssl_conf_filename[MAXPATHLEN];
struct php_x509_request {
- LHASH * global_config; /* Global SSL config */
- LHASH * req_config; /* SSL config for this request */
+ LHASH_OF(CONF_VALUE) * global_config; /* Global SSL config */
+ LHASH_OF(CONF_VALUE) * req_config; /* SSL config for this request */
const EVP_MD * md_alg;
const EVP_MD * digest;
char * section_name,
@@ -364,7 +364,7 @@
const char * section_label,
const char * config_filename,
const char * section,
- LHASH * config TSRMLS_DC)
+ LHASH_OF(CONF_VALUE) * config TSRMLS_DC)
{
X509V3_CTX ctx;
--- config.m4.orig 2012-11-15 17:20:41.343466640 +0100
+++ config.m4 2012-11-15 17:31:37.801466533 +0100
@@ -1,35 +1,24 @@
-dnl $Id: config.m4,v 1.14.2.5 2006/02/16 02:03:13 pollita Exp $
-
-if test "$PHP_PDO" != "no"; then
+dnl $Id$
+dnl config.m4 for extension pdo_oci
+dnl vim:et:sw=2:ts=2:
+SUPPORTED_LIB_VERS="9.0 10.1 11.1" # This caters for all Oracle 9.x, 10.x and 11.1 installs
AC_DEFUN([AC_PDO_OCI_VERSION],[
AC_MSG_CHECKING([Oracle version])
- if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then
- PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
- elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
- PDO_OCI_VERSION=10.1
- elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
- PDO_OCI_VERSION=9.0
- elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
- PDO_OCI_VERSION=8.1
- elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
- PDO_OCI_VERSION=8.0
- elif test -f $PDO_OCI_LIB_DIR/libclntsh.a; then
- if test -f $PDO_OCI_LIB_DIR/libcore4.a; then
- PDO_OCI_VERSION=8.0
- else
- PDO_OCI_VERSION=8.1
- fi
- else
- AC_MSG_ERROR(Oracle-OCI needed libraries not found under $PDO_OCI_DIR)
+ for OCI_VER in $SUPPORTED_LIB_VERS; do
+ if test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.$OCI_VER; then
+ PDO_OCI_VERSION="$OCI_VER"
+ fi
+ done
+ if test -z "$PDO_OCI_VERSION"; then
+ AC_MSG_ERROR([Oracle required OCI8 libraries not found under $PDO_OCI_DIR])
fi
AC_MSG_RESULT($PDO_OCI_VERSION)
])
AC_DEFUN([AC_PDO_OCI_CHECK_LIB_DIR],[
AC_CHECK_SIZEOF(long int, 4)
- AC_MSG_CHECKING([checking if we're at 64-bit platform])
+ AC_MSG_CHECKING([if we're on a 64-bit platform])
if test "$ac_cv_sizeof_long_int" = "4" ; then
AC_MSG_RESULT([no])
TMP_PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
@@ -39,74 +28,95 @@
fi
AC_MSG_CHECKING([OCI8 libraries dir])
- if test -d "$PDO_OCI_DIR/lib" -a ! -d "$PDO_OCI_DIR/lib32"; then
+ if test -d "$PDO_OCI_DIR/lib" && test ! -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib"
- elif ! test -d "$PDO_OCI_DIR/lib" -a -d "$PDO_OCI_DIR/lib32"; then
+ elif test ! -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR="$PDO_OCI_DIR/lib32"
- elif test -d "$PDO_OCI_DIR/lib" -a -d "$PDO_OCI_DIR/lib32"; then
+ elif test -d "$PDO_OCI_DIR/lib" && test -d "$PDO_OCI_DIR/lib32"; then
PDO_OCI_LIB_DIR=$TMP_PDO_OCI_LIB_DIR
else
- AC_MSG_ERROR([Oracle (OCI8) required libraries not found])
+ AC_MSG_ERROR([Oracle required OCI8 libraries not found])
fi
AC_MSG_RESULT($PDO_OCI_LIB_DIR)
])
PHP_ARG_WITH(pdo-oci, Oracle OCI support for PDO,
-[ --with-pdo-oci[=DIR] PDO: Oracle-OCI support. Default DIR is ORACLE_HOME.
- You may also use --with-pdo-oci=instantclient,prefix,version to use
- the InstantClient SDK. For Linux with 10.1.0.3 rpms (for example) use:
- --with-pdo-oci=instantclient,/usr,10.1.0.3])
+[ --with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to \$ORACLE_HOME.
+ Use --with-pdo-oci=instantclient,prefix,version
+ for an Oracle Instant Client SDK.
+ For example on Linux with 11.2 RPMs use:
+ --with-pdo-oci=instantclient,/usr,11.2
+ With 10.2 RPMs use:
+ --with-pdo-oci=instantclient,/usr,10.2.0.4])
if test "$PHP_PDO_OCI" != "no"; then
+
+ if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
+ AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
+ fi
+
AC_MSG_CHECKING([Oracle Install-Dir])
if test "$PHP_PDO_OCI" = "yes" || test -z "$PHP_PDO_OCI"; then
PDO_OCI_DIR=$ORACLE_HOME
else
PDO_OCI_DIR=$PHP_PDO_OCI
fi
- AC_MSG_RESULT($PDO_OCI_DIR :$PHP_PDO_OCI:)
+ AC_MSG_RESULT($PHP_PDO_OCI)
AC_MSG_CHECKING([if that is sane])
if test -z "$PDO_OCI_DIR"; then
AC_MSG_ERROR([
-You need to tell me where to find your oracle SDK, or set ORACLE_HOME.
+You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.
])
else
AC_MSG_RESULT([yes])
fi
- AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)
-
if test "instantclient" = "`echo $PDO_OCI_DIR | cut -d, -f1`" ; then
+ AC_CHECK_SIZEOF(long int, 4)
+ if test "$ac_cv_sizeof_long_int" = "4" ; then
+ PDO_OCI_CLIENT_DIR="client"
+ else
+ PDO_OCI_CLIENT_DIR="client64"
+ fi
PDO_OCI_IC_PREFIX="`echo $PDO_OCI_DIR | cut -d, -f2`"
PDO_OCI_IC_VERS="`echo $PDO_OCI_DIR | cut -d, -f3`"
+ if test -n "$PDO_OCI_IC_VERS"; then
+ PDO_OCI_IC_MAJ_VER="`echo $PDO_OCI_IC_VERS | cut -d. -f1`"
+ if test "$PDO_OCI_IC_MAJ_VER" -ge 11; then
+ # From 11.1.0.7 the RPM path only has an X.Y component
+ PDO_OCI_IC_VERS="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
+ fi
+ fi
AC_MSG_CHECKING([for oci.h])
- if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client/oci.h ; then
- PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
- AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/client)
- elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
- PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
- AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
+ if test -f $PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/oci.h ; then
+ PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
+ AC_MSG_RESULT($PDO_OCI_IC_PREFIX/include/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR)
+ elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
+ PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
+ AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/include)
elif test -f $PDO_OCI_IC_PREFIX/sdk/include/oci.h ; then
PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/sdk/include)
AC_MSG_RESULT($PDO_OCI_IC_PREFIX/sdk/include)
- elif test -f $PDO_OCI_IC_PREFIX/client/include/oci.h ; then
- PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/client/include)
- AC_MSG_RESULT($PDO_OCI_IC_PREFIX/client/include)
+ elif test -f $PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include/oci.h ; then
+ PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
+ AC_MSG_RESULT($PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/include)
else
- AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant client install])
+ AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your Instant Client install])
fi
- if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.so" ; then
- PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
- elif test -f "$PDO_OCI_IC_PREFIX/client/lib/libclntsh.so" ; then
- PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/client/lib"
- elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.so" ; then
+ if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
+ PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/$PDO_OCI_CLIENT_DIR/lib"
+ elif test -f "$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
+ PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/$PDO_OCI_CLIENT_DIR/lib"
+ elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.$SHLIB_SUFFIX_NAME" ; then
PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
else
- AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your instant client install])
+ AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your Instant Client install])
fi
PDO_OCI_VERSION="`echo $PDO_OCI_IC_VERS | cut -d. -f1-2`"
else
+ AC_PDO_OCI_CHECK_LIB_DIR($PDO_OCI_DIR)
+
if test -d "$PDO_OCI_DIR/rdbms/public"; then
PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)
PDO_OCI_INCLUDES="$PDO_OCI_INCLUDES -I$PDO_OCI_DIR/rdbms/public"
@@ -137,29 +147,12 @@
fi
case $PDO_OCI_VERSION in
- 8.0)
- PHP_ADD_LIBRARY_WITH_PATH(nlsrtl3, "", PDO_OCI_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(core4, "", PDO_OCI_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(psa, "", PDO_OCI_SHARED_LIBADD)
- PHP_ADD_LIBRARY_WITH_PATH(clntsh, $PDO_OCI_LIB_DIR, PDO_OCI_SHARED_LIBADD)
- ;;
-
- 8.1)
+ 9.0|10.1|10.2|11.1|11.2)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
;;
- 9.0)
- PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
- ;;
-
- 10.1)
- PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
- ;;
- 10.2)
- PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
- ;;
*)
- AC_MSG_ERROR(Unsupported Oracle version! $PDO_OCI_VERSION)
+ AC_MSG_ERROR(Unsupported Oracle version $PDO_OCI_VERSION)
;;
esac
@@ -221,18 +214,18 @@
],[
AC_MSG_CHECKING([for PDO includes])
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=$abs_srcdir/ext
+ pdo_cv_inc_path=$abs_srcdir/ext
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=$abs_srcdir/ext
+ pdo_cv_inc_path=$abs_srcdir/ext
elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
- pdo_inc_path=$prefix/include/php/ext
+ pdo_cv_inc_path=$prefix/include/php/ext
else
AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
fi
- AC_MSG_RESULT($pdo_inc_path)
+ AC_MSG_RESULT($pdo_cv_inc_path)
])
- PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_inc_path)
+ PHP_NEW_EXTENSION(pdo_oci, pdo_oci.c oci_driver.c oci_statement.c, $ext_shared,,-I$pdo_cv_inc_path)
PHP_SUBST_OLD(PDO_OCI_SHARED_LIBADD)
PHP_SUBST_OLD(PDO_OCI_DIR)
@@ -242,7 +235,6 @@
[
PHP_ADD_EXTENSION_DEP(pdo_oci, pdo)
])
-
-fi
+ AC_DEFINE_UNQUOTED(PHP_PDO_OCI_CLIENT_VERSION, "$PDO_OCI_VERSION", [ ])
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment