Installing PHP OAuth library in Mac OS X

Check the current version of OAuth you wanted to install in http://pecl.php.net/package/oauth

Then just copy the link and use wget, since I love wget.

wget http://pecl.php.net/get/oauth-1.2.3.tgz

where 1.2.3 is the current version as of this writing.

Then decompress it by

tar -xzvf oauth-1.2.3.tgz

Now go into that directory where the source has been extracted and run,

$> CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure

if you encounter an error like this,

....
auth.c  -fno-common -DPIC -o .libs/oauth.o
In file included from /var/root/oauth-1.2.3/php_oauth.h:47,
                 from /var/root/oauth-1.2.3/oauth.c:14:
/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /var/root/oauth-1.2.3/php_oauth.h:47,
                 from /var/root/oauth-1.2.3/oauth.c:14:
/usr/include/php/ext/pcre/php_pcre.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/php/ext/pcre/php_pcre.h:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before ‘pcre’
make: *** [oauth.lo] Error 1

that's because in your CPPFLAGS, it was not able to locate headers that are required, or particularly, pcre.h as seen above. If you take a look at the file  /usr/include/php/ext/pcre/php_pcre.h, you can see that there's an include of header involving pcre.h

To fix that, try to look, or perhaps install PCRE library which include this header. In my setup, I have already an available headers found in /opt/local/include, so what I did is just,


$> CPPFLAGS="-I/usr/local/include -I/opt/local/include" LDFLAGS="-L/usr/lib -L/opt/local/lib" ./configure

then run "make && make install" after.


$> make && make install


Afterall is successful, just edit your php.ini and include oauth.so, where mine is placed in

/usr/lib/php/extensions/no-debug-non-zts-20090626/


and put,

extension=oauth.so

to load the module. Seeing <?php phpinfo(); ?> in your code will print that information regarding your OAuth module installed.



Comments

Popular posts from this blog

Converting sectors into MB - Useful in understanding the sectors in iostat in Linux

What is Disk Contention?

Installing MySQL from source: Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)