0

I have already installed Apache 2.4.4 & PHP 5.4 from source in my Ubuntu 10.04 machine. I also installed MySQL 5.6 from source and SQL commands are running from shell.

When I use an SQL function to connect to database, it throws a fatal error that this function is not defined.

I know I can configure PHP for MySQL by providing the directory of MySQL while installing PHP, but now I have already installed & configured Apache & PHP and they are working, so please tell me how to configure PHP for MySQL support.

Thanks.

3
  • which sql function are you running and what it returns? Commented Apr 11, 2013 at 8:33
  • mysql_connect(), but I think it does not matter as php does not know where I have installed mysql. It will throw error for any mysql function. Commented Apr 11, 2013 at 8:36
  • mysql_connect() , when run browser has a error message Fatal Error: Call to undefined function mysql_connect(). Commented Apr 11, 2013 at 9:49

1 Answer 1

0

Recompile php with --with-mysql OR --with-mysqli directive. This way you can add required extensions to php. See php-mysql OR php-mysqli

2
  • Is there not any other option where I have not to recompile it? As I think this will include some overhead of copying php ini files to /usr/local/lib and edit some other configurations or just a recompilation needed? Commented Apr 11, 2013 at 8:45
  • Personally I think recompiling should be your only option as you compile already php. However you can try to enable mysql.so or mysqli.so in php.ini and restart apache if it can works. Commented Apr 11, 2013 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.