Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm attempting to implement a mysql logger similar to what is described in the following article using the mysqlnd_uh extension.

http://blog.mayflower.de/archives/578-MySQLnd-Plugins-Writing-a-MySQL-Query-Logger-in-PHP.html

How it's supposed to work is that it will intercept calls that go into mysql and mysqli functions into a proxy class where we can intercept the call for logging purposes. Naturally this client library requires the Mysql native driver which isn't installed with PHP 5.3 so I followed the procedures in this tutorial in order to check out the source code of Apache and PHP and compile them onto my VM running the latest version of Ubuntu with compiling options for mysqli and mysql set to mysqlnd.

http://www.web-tech-india.com/articles/php/compiling_php_apache/

That seemed to work well since I can access the mysqli_fetch_all function which is only supported from within mysqlnd.

Now what I am attempting to do is to install the mysqlnd_uh plugin using pecl.

sudo /home/jason/pear/bin/pecl install mysqlnd_uh-alpha

This runs ok for the configure part but fails in the make with the following error. Clearly it's complaining about not finding a source file but where does it look? Should I pass in a parameter into pecl to point to where my copy of the php source code is? In the tutorial it told me to compile apache with the --enable-so option, could that be causing confusion?

running: make
/bin/bash /tmp/pear/install/pear-build-roothNJj2h/mysqlnd_uh-0.1.0a1/libtool --mode=compile cc  -I. -I/tmp/pear/install/mysqlnd_uh -DPHP_ATOM_INC -I/tmp/pear/install/pear-build-roothNJj2h/mysqlnd_uh-0.1.0a1/include -I/tmp/pear/install/pear-build-roothNJj2h/mysqlnd_uh-0.1.0a1/main -I/tmp/pear/install/mysqlnd_uh -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/install/mysqlnd_uh/php_mysqlnd_uh.c -o php_mysqlnd_uh.lo
libtool: compile:  cc -I. -I/tmp/pear/install/mysqlnd_uh -DPHP_ATOM_INC -I/tmp/pear/install/pear-build-roothNJj2h/mysqlnd_uh-0.1.0a1/include -I/tmp/pear/install/pear-build-roothNJj2h/mysqlnd_uh-0.1.0a1/main -I/tmp/pear/install/mysqlnd_uh -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/install/mysqlnd_uh/php_mysqlnd_uh.c  -fPIC -DPIC -o .libs/php_mysqlnd_uh.o
In file included from /tmp/pear/install/mysqlnd_uh/php_mysqlnd_uh.c:23:0:
/tmp/pear/install/mysqlnd_uh/mysqlnd_uh.h:46:33: fatal error: ext/mysqlnd/mysqlnd.h: No such file or directory
compilation terminated.
make: *** [php_mysqlnd_uh.lo] Error 1
ERROR: `make' failed

Thanks for any hints! Jason

share|improve this question

migrated from stackoverflow.com Oct 30 '11 at 13:18

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Edit: Try # sudo apt-get install php5-dev that should install the headers, then try installing the extension again. If it works, great !

But if it doesnt then we have to go step by step. First, the link to compile PHP+Apache is for PHP 4.3 , same can not be true for PHP 5.3, this link should be good for PHP 5.3 compilation. Try following those instructions

BTW, what does # sudo updatedb; locate 'mysqlnd.h' returns ? I am guessing that PHP sources (that you might have downloaded using those links aren't placed in appropriate places (or the header files do not exist) and hence the error

PS: Will update this answer as it progresses

share|improve this answer
    
Hi Sudhi, Thanks for the information. install php5-dev returned saying that it was already the latest version. So it failed again when I tried grabbing mysqlnd_uh. I followed the instructions in the 2nd tutorial that I linked to. It suggested to place the apache code in /wwwroot/ so that is where my files are. Here is the result of the locate command... –  Jason Turan Oct 28 '11 at 0:09
    
jason@jason-VirtualBox:~$ sudo updatedb; locate 'mysqlnd.h' /usr/src/php-5.3.8/ext/mysql/mysql_mysqlnd.h /usr/src/php-5.3.8/ext/mysqli/mysqli_mysqlnd.h /usr/src/php-5.3.8/ext/mysqlnd/mysqlnd.h /usr/src/php-5.3.8/ext/mysqlnd/php_mysqlnd.h /wwwroot/php/include/php/ext/mysqlnd/mysqlnd.h /wwwroot/php/include/php/ext/mysqlnd/php_mysqlnd.h –  Jason Turan Oct 28 '11 at 0:09
    
I think the install of mysqlnd went ok since I can use the mysqli_fetch_all function as described in this SO article. stackoverflow.com/questions/1475701/… Would you recommend I uninstall mysql and apache and try again with the other tutorial? –  Jason Turan Oct 28 '11 at 0:12
    
I tried following that article as well and the problem I was running into is that after modifying the rules file and attempting to build the package using the sudo dpkg-buildpackage command it would faile with the following error message. Umnet build dependencies: locales-all | language-pack-de –  Jason Turan Oct 28 '11 at 0:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.