mysqli

php with mysqlnd support

You can now get the latest PHP with mysqlnd (MySQL Native Driver) support via remis' yum repository as mentioned in PHP-5.3,-zts-and-mysqlnd. The blog mentions that this is enabld in php-zts. However, no php-pecl extension are available and neither are some of the extensions thread safe. So I went about rebuilding php package from source for mysqlnd support.

  1. Download the source php rpm from http://rpms.famillecollet.com/SRPMS/ . Note, I have used php-5.3.2 which is the latest as of this writing.
  2. Install and apply the below diff patch to the spec file via `patch -p0 < {new_patch_file}` where "new_patch_file" has the below contents:

    --- php-5.3.2-remi.spec.orig 2010-03-11 23:07:04.000000000 -0600
    +++ php-5.3.2-remi.spec 2010-03-11 23:36:03.000000000 -0600
    @@ -24,6 +24,7 @@
    %global phpversion 5.3.2

    # Optional components; pass "--with mssql" etc to rpmbuild.
    +%define with_mysqlnd %{?_with_mysqlnd:1}%{!?_with_mysqlnd:0}
    %define with_oci8 %{?_with_oci8:1}%{!?_with_oci8:0}
    %define with_ibase %{?_with_ibase:1}%{!?_with_ibase:0}
    %if %{?rhel}%{?fedora} > 4
    @@ -677,6 +678,11 @@
    %if %{?fedora}%{?rhel:99} >= 10
             --with-system-tzdata \
    %endif
    +%if %{with_mysqlnd}
    +        --with-mysql=shared,mysqlnd \
    +        --with-mysqli=shared,mysqlnd \
    +        --with-pdo-mysql=shared,mysqlnd \
    +%endif
    $*
    if test $? != 0; then
       tail -500 config.log
    @@ -704,8 +710,13 @@
           --enable-dba=shared --with-db4=%{_prefix} \
           --with-xmlrpc=shared \
           --with-ldap=shared --with-ldap-sasl \
    +%if %{with_mysqlnd}
    +      --with-mysql=shared,mysqlnd \
    +      --with-mysqli=shared,mysqlnd \
    +%else
           --with-mysql=shared,%{_prefix} \
           --with-mysqli=shared,%{_bindir}/mysql_config \
    +%endif
    %ifarch x86_64
           %{?_with_oci8:--with-oci8=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client64/lib,%{oraclever}} \
    %else
    @@ -725,7 +736,11 @@
           --enable-fastcgi \
           --enable-pdo=shared \
           --with-pdo-odbc=shared,unixODBC,%{_prefix} \
    +%if %{with_mysqlnd}
    +      --with-pdo-mysql=shared,mysqlnd \
    +%else
           --with-pdo-mysql=shared,%{_prefix} \
    +%endif
           --with-pdo-pgsql=shared,%{_prefix} \
           --with-pdo-sqlite=shared,%{_prefix} \
           --with-pdo-dblib=shared,%{_prefix} \
    @@ -756,6 +771,16 @@
           --with-recode=shared,%{_prefix}
    popd

    +%if %{with_mysqlnd}
    +without_shared="--without-gd \
    +      --disable-dom --disable-dba --without-unixODBC \
    +      --disable-xmlreader --disable-xmlwriter \
    +      --without-sqlite \
    +      --disable-phar --disable-fileinfo \
    +      --disable-json --without-pspell --disable-wddx \
    +      --without-curl --disable-posix \
    +      --disable-sysvmsg --disable-sysvshm --disable-sysvsem"
    +%else
    without_shared="--without-mysql --without-gd \
           --disable-dom --disable-dba --without-unixODBC \
           --disable-pdo --disable-xmlreader --disable-xmlwriter \
    @@ -764,6 +789,7 @@
           --disable-json --without-pspell --disable-wddx \
           --without-curl --disable-posix \
           --disable-sysvmsg --disable-sysvshm --disable-sysvsem"
    +%endif

    # Build Apache module, and the CLI SAPI, /usr/bin/php
    pushd build-apache

  3. Package with:
    rpmbuild -bb --with mysqlnd --define "rhel 5" SPECS/php-5.3.2-remi.spec
    
  4. To install via yum, change to the directory where rpms are located and recreate the repodata via:
    createrepo .
  5. Note: you may need to install some of the missing dependent devel packages. I used a combination of base, epel and remi repository to install the dependencies.

Syndicate content
Comment