Wednesday, February 24, 2010

PHP

I was unable to install today PECL extention PDO_MYSQL via

sudo pecl install PDO_MYSQL


The problem was that after configure, make can't find mysql header files.

...
In file included from /tmp/pear/temp/PDO_MYSQL/pdo_mysql.c:31:
/tmp/pear/temp/PDO_MYSQL/php_pdo_mysql_int.h:25:19: mysql.h: No such file or directory
In file included from /tmp/pear/temp/PDO_MYSQL/pdo_mysql.c:31:
/tmp/pear/temp/PDO_MYSQL/php_pdo_mysql_int.h:36: error: syntax error before "MYSQL"
...


So I learned how to make an extension manually.
I ran locate mysql.h, copyed all mysql headers from there to current folder and now you can make it

phpize --clean
phpize
./configure
make


make install won't worked for me.
pdo_mysql.so placed in modules dir, copy it to extentions dir (php -i | grep extension_dir) and enable in php.ini.

These steps will not add PDO_MYSQL under the PEAR, so you need to maintain it by yourself. But to update list of installed packages, you can do this trick

sudo pecl install -rB pdo_mysql

-r means do not install files, only register the package as installed
-B means don't build C extensions

Some other good to read links
Topic : pdo_mysql.so driver Installation

No comments:

Post a Comment