0

Now, before someone marks this as a duplicate, I've been looking around on the internet for the last two days and have been unable to find a resolve for my issue.

All I'm trying to do is simply get mysql to run with php. But, no matter what I do, it still says that both mysql_connect() and mysqli_connect() are undefined functions.

I've tried installing both php5-mysql and php5-mysqlnd. I've tried configuring php.ini to enable the extension (I'd prefer to use the absolute path, but I cannot find mysql.so's absolute path anywhere on the internet).

I've tried uninstalling and purging all php/apache/mysql installations and reinstalling Apache, MySQL and PHP using this installation process http://howtoubuntu.org/how-to-install-lamp-on-ubuntu

And, people keep asking if I remembered to restart apache, yes, I did. No change.

Any light anyone can shed on this I'd be incredibly grateful for.

Some data you might find useful:

nathanf@nathanf:~⟫ php -v
PHP 5.3.29 (cli) (built: Mar 18 2016 02:32:59) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

nathanf@nathanf:~⟫ php -m | grep mysql
<this didn't have any output>

nathanf@nathanf:~⟫ dpkg -s libapache2-mod-php5 | grep Status
Status: install ok installed

nathanf@nathanf:~⟫ dpkg -s php5-mysql | grep Status
Status: deinstall ok config-files

nathanf@nathanf:~⟫ dpkg -s php5-mysqlnd | grep Status
Status: install ok installed

sudo service apache2 restart;tail /var/log/apache2/error.log
 * Restarting web server apache2
...done.
[Wed Apr 06 10:09:08.209690 2016] [core:notice] [pid 27834] AH00094:       Command line: '/usr/sbin/apache2'
[Wed Apr 06 10:11:35.337736 2016] [mpm_prefork:notice] [pid 27834] AH00169: caught SIGTERM, shutting down
[Wed Apr 06 10:11:36.392695 2016] [mpm_prefork:notice] [pid 31633] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Wed Apr 06 10:11:36.392726 2016] [core:notice] [pid 31633] AH00094: Command line: '/usr/sbin/apache2'
[Wed Apr 06 10:12:39.700572 2016] [mpm_prefork:notice] [pid 31633] AH00169: caught SIGTERM, shutting down
[Wed Apr 06 10:12:40.755404 2016] [mpm_prefork:notice] [pid 919] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Wed Apr 06 10:12:40.755434 2016] [core:notice] [pid 919] AH00094: Command line: '/usr/sbin/apache2'
[Wed Apr 06 16:37:30.038532 2016] [mpm_prefork:notice] [pid 919] AH00169: caught SIGTERM, shutting down
[Wed Apr 06 16:37:31.371803 2016] [mpm_prefork:notice] [pid 25602] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.14 configured -- resuming normal operations
[Wed Apr 06 16:37:31.371836 2016] [core:notice] [pid 25602] AH00094: Command line: '/usr/sbin/apache2'

1 Answer 1

0

Show the output of

  1. php -v
  2. php -m | grep mysql
  3. dpkg -s libapache2-mod-php5 | grep Status
  4. dpkg -s php5-mysql | grep Status
  5. dpkg -s php5-mysqlnd | grep Status
  6. messages in /var/log/apache2/error.log right after restarting apache

By the way, the path to mysql.so is probably /usr/lib/php5/20121212/mysql.so

7
  • Please view the latest edit for these details, thanks.
    – Nathan F.
    Commented Apr 6, 2016 at 23:39
  • As I can see, you are using outdated php version. Well, can you find mysqlnd.ini section in /etc/php5/conf.d folder? And mysqlnd.so in /usr/lib/php5/2009... ? Did you updated your repositories? Commented Apr 7, 2016 at 5:01
  • Yes, the repositories are up to date. As far as the files you mentioned, neither of those folder exist. Here is how the file tree looks around those directories you asked about: hastebin.com/jahahocive.avrasm
    – Nathan F.
    Commented Apr 7, 2016 at 18:05
  • I can not see your screenshot - it is empty. The problem is that your command line interface gives php version 5.3.29, but apache is built to work with PHP 5.5.9-1ubuntu4.14. It seems that you installed php5 from non-ubuntu repository or built form sources whithout option --with-mysql. Commented Apr 7, 2016 at 19:18
  • @oleg-boden It's not a screenshot, it's a hastebin. And I've not modified the repositories at all. It's using the defaults that came with Ubuntu 14.04. If there is a newer version, what is it / how do i add it?
    – Nathan F.
    Commented Apr 7, 2016 at 20:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .