apache2 - Upgrade PHP to 5.4.14 on OS X 10.7.5 Lion

20
2014-03
  • Mike Kormendy

    I am trying to upgrade PHP on my Mac. I have downloaded PHP 5.4.14 and have no problems with the configuration command:

    ./configure \
     --prefix=/usr \
     --mandir=/usr/share/man \
     --infodir=/usr/share/info \
     --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-dba \
     --enable-exif \
     --enable-ftp \
     --with-gd \
     --with-freetype-dir=/usr/X11 \
     --with-jpeg-dir=/BinaryCache/apache_mod_php/apache_mod_php-66.6~1/Root/usr/local \
     --with-png-dir=/usr/X11 \
     --enable-gd-native-ttf \
     --with-icu-dir=/usr \
     --with-iodbc=/usr \
     --with-ldap=/usr \
     --with-ldap-sasl=/usr \
     --with-libedit=/usr \
     --enable-mbstring \
     --enable-mbregex \
     --with-mysql=mysqlnd \
     --with-mysqli=mysqlnd \
     --without-pear \
     --with-pdo-mysql=mysqlnd \
     --with-mysql-sock=/var/mysql/mysql.sock \
     --with-readline=/usr \
     --enable-shmop \
     --with-snmp=/usr \
     --enable-soap \
     --enable-sockets \
     --enable-sysvmsg \
     --enable-sysvsem \
     --enable-sysvshm \
     --with-tidy \
     --enable-wddx \
     --with-xmlrpc \
     --without-iconv \
     --with-xsl=/usr \
     --enable-zip \
     --with-pcre-regex=/usr \
     --with-pgsql=/usr \
     --with-pdo-pgsql=/usr
    

    When I do a make test I get a long slew of stuff with the following at the end:

    Undefined symbols for architecture x86_64:
      "_php_pcre_compile", referenced from:
          _pcre_get_compiled_regex_cache in php_pcre.o
      "_php_pcre_exec", referenced from:
          _php_pcre_grep_impl in php_pcre.o
          _php_pcre_replace_impl in php_pcre.o
          _php_pcre_match_impl in php_pcre.o
          _php_pcre_split_impl in php_pcre.o
          _check_fmt in softmagic.o
          _php_filter_validate_email in logical_filters.o
          _php_filter_validate_regexp in logical_filters.o
          ...
      "_php_pcre_free", referenced from:
          _php_pcre_match_impl in php_pcre.o
      "_php_pcre_fullinfo", referenced from:
          _pcre_get_compiled_regex_cache in php_pcre.o
          _php_pcre_grep_impl in php_pcre.o
          _make_subpats_table in php_pcre.o
          _php_pcre_replace_impl in php_pcre.o
          _php_pcre_match_impl in php_pcre.o
          _php_pcre_split_impl in php_pcre.o
      "_php_pcre_get_substring_list", referenced from:
          _php_pcre_match_impl in php_pcre.o
      "_php_pcre_maketables", referenced from:
          _pcre_get_compiled_regex_cache in php_pcre.o
      "_php_pcre_study", referenced from:
          _pcre_get_compiled_regex_cache in php_pcre.o
      "_php_pcre_version", referenced from:
          _zm_info_pcre in php_pcre.o
          _zm_startup_pcre in php_pcre.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [libs/libphp5.bundle] Error 1
    

    I have updated PCRE on the system to version 8.32, and I require it due to some zlib dependencies amongst other things and general perl regular expression stuff. I'm at a loss as to why my make test won't pass.

    Any help would be appreciated to fix this problem.

  • Answers
  • emcconville

    Option 1

    Simply remove the --with-pcre-regex options. Modern version of PHP ship with PCRE library (located in ext/pcre/pcrelib), and is considered part of the core PHP build.

    From php.net,

    Note:

    As of PHP 5.3.0 this extension cannot be disabled and is therefore always present.

    It is still possible to build against an external PCRE library by using --with-pcre-regex=DIR

    Option 2

    As the note above states, you can build PHP with an external PCRE library. To do so, updated the --with-pcre-regex option with value returned by pcre-config --prefix.


  • Related Question

    Mac OSX Lion Apache server takes a while to start serving php scripts
  • Stian Håklev

    I use the built in Apache (web sharing) and the built in PHP in OSX Lion to run DokuWiki as a personal information manager (nobody connects externally). From the previous version of OSX, there seems to be a chance in how web sharing works, and when I first try to open a page on localhost after not having used it for a while, it takes quite a while (upwards of 45 seconds) before the server responds. Subsequent pages are very quick. I wonder if this is some kind of "sleep function" where it suspends Apache when not in use, to save energy.

    Is there a setting I can change to make it always respond right away?


  • Related Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.