Reputation: 49
I'm really stuck on this I've been searching for hours...
I recently installed an Apache server on a remote Ubuntu box for my website and I wanted to get started with PHP and MySQL. MySQL is installed and running. PHP installed fine, that works, but I can't figure out how to enable the MySQL extension. I've already done sudo apt-get install php5-mysql
and/or sudo apt-get install php5-mysqlnd
but neither of those seemed to actually install anything, at least according to my Apache server. When I run php -m
I see mysql, mysqli, and mysqlnd. I've also tried uncommenting the lines for loading the extensions in the Apache php.ini
file but none of the mysql.so
or mysqli.so
or whatever exist in the default extension directory. There is another PHP extensions directory with those files in it, but when I tried pointing my Apache server to that extension directory, I got errors saying this:
/usr/local/lib/php/extensions/no-debug-zts-20131226/mysqli.so: undefined symbol: core_globals in Unknown on line 0
I've tried everything I've seen so far and nothing has worked. That error was the closest I got. Any help is appreciated.
Also here's my phpinfo()
output: http://pastebin.com/VM8kyrKV
I also get this when I run sudo apt-get install php5-mysqlnd
:
php5_invoke: Enable module mysqlnd for cli SAPI
php5_invoke: Enable module mysqlnd for apache2 SAPI
php5_invoke: Enable module mysql for cli SAPI
php5_invoke: Enable module mysql for apache2 SAPI
php5_invoke: Enable module mysqli for cli SAPI
php5_invoke: Enable module mysqli for apache2 SAPI
php5_invoke: Enable module pdo_mysql for cli SAPI
php5_invoke: Enable module pdo_mysql for apache2 SAPI
Which seems to look good but it's still not working... I can't find any mysql module files anywhere except the ones for CLI PHP.
Edit:
Long story short, don't compile your own binaries... I started over only using apt-get
to install things and everything just worked.
Upvotes: 1
Views: 4712
Reputation: 42709
I've already done sudo apt-get install php5-mysql and/or sudo apt-get install php5-mysqlnd but neither of those seemed to actually install anything, at least according to my Apache server.
Your output from phpinfo()
shows both the mysql and mysqlnd modules are active. This suggests the install was successful and you just need to uncomment the line to load mysqli.so. Make sure you're editing the file for the Apache instance (/etc/php5/apache2/php.ini
if I'm remembering correctly) and not the CLI instance. And of course don't forget to restart the service after any changes!
Upvotes: 2