Installing OAuth PECL extension for XAMPP beta on Mac

Recently I ran into problems when installing OAuth PECL extension for XAMPP beta on Mac OS-X. Running pecl from the command line gave the following error:

bash-3.2$ /Applications/XAMPP/xamppfiles/bin/pecl

Notice: unserialize(): Error at offset 250 of 1301 bytes in Config.php on line 1050
ERROR: The default config file is not a valid config file or is corrupted.

Luckily, the solution to this problem is pretty simple. First, delete pear.conf by making a backup in your XAMPP setup:

bash-3.2$ mv pear.conf pear.conf.backup

This way PECL will create a new and correct config file when running the command again. Obviously, XAMPP ships with a corrupt pear.conf.

Then, install the OAuth extension as usual:

bash-3.2$ sudo /Applications/XAMPP/xamppfiles/bin/pecl install oauth
...
downloading oauth-1.2.3.tgz ...
Starting to download oauth-1.2.3.tgz (45,531 bytes)
.............done: 45,531 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
building in /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3
running: /private/tmp/pear/temp/oauth/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-apple-darwin12.4.0
checking host system type... i386-apple-darwin12.4.0
checking target system type... i386-apple-darwin12.4.0
checking for PHP prefix... /Applications/XAMPP/xamppfiles
checking for PHP includes... -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib
checking for PHP extension directory... /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /Applications/XAMPP/xamppfiles/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for oauth support... yes, shared
checking for cURL in default path... found in /usr
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.4.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/include -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/main -I/private/tmp/pear/temp/oauth -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /private/tmp/pear/temp/oauth/oauth.c -o oauth.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/include -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/main -I/private/tmp/pear/temp/oauth -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /private/tmp/pear/temp/oauth/oauth.c  -fno-common -DPIC -o .libs/oauth.o
/private/tmp/pear/temp/oauth/oauth.c:507:19: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types]
                Z_STRVAL(first) = f->arKey;
                                ^ ~~~~~~~~
/private/tmp/pear/temp/oauth/oauth.c:516:20: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types]
                Z_STRVAL(second) = s->arKey;
                                 ^ ~~~~~~~~
2 warnings generated.
/bin/sh /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/include -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/main -I/private/tmp/pear/temp/oauth -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -c /private/tmp/pear/temp/oauth/provider.c -o provider.lo
 cc -I. -I/private/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/include -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/main -I/private/tmp/pear/temp/oauth -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /private/tmp/pear/temp/oauth/provider.c  -fno-common -DPIC -o .libs/provider.o
/bin/sh /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/include -I/private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/main -I/private/tmp/pear/temp/oauth -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2 -Wall -g   -o oauth.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/modules  oauth.lo provider.lo -lcurl
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/oauth.so -bundle  .libs/oauth.o .libs/provider.o  -lcurl
dsymutil .libs/oauth.so || :
creating oauth.la
(cd .libs && rm -f oauth.la && ln -s ../oauth.la oauth.la)
/bin/sh /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/libtool --mode=install cp ./oauth.la /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/modules
cp ./.libs/oauth.so /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/modules/oauth.so
cp ./.libs/oauth.lai /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/modules/oauth.la
----------------------------------------------------------------------
Libraries have been installed in:
   /private/tmp/pear/temp/pear-build-rootjw6ahH/oauth-1.2.3/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3" install
Installing shared extensions:     /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20100525/
running: find "/private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3" | xargs ls -dils
5144976   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3
5145326   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications
5145327   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP
5145328   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles
5145329   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib
5145330   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib/php
5145331   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib/php/extensions
5145332   0 drwxr-xr-x  3 root  wheel     102 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20100525
5145333 200 -rwxr-xr-x  1 root  wheel  101592 30 Sep 17:09 /private/tmp/pear/temp/pear-build-rootjw6ahH/install-oauth-1.2.3/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20100525/oauth.so

Build process completed successfully
Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20100525/oauth.so'
install ok: channel://pecl.php.net/oauth-1.2.3
Extension oauth enabled in php.ini

That’s it.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *