Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => Linux Servers Support => Topic started by: bulletproof.rs on June 14, 2011, 12:57:22 PM

Title: [SOLVED]Fatal error: Call to undefined function mysql_connect()
Post by: bulletproof.rs on June 14, 2011, 12:57:22 PM
I know that you already had some cases of this error on this forum, and i wouldn't like to open up old topics, but none of the solutions mentioned before, helped.

I am trying to run a local php script on a Debian based server, but every time i run it, i get this error message:

Code: [Select]
Fatal error: Call to undefined function mysql_connect() in /home/aod/SpinGather/databases/mysql.php on line 59
MySQL Server and MySQL module for php is loaded correctly, as you may already see here
Code: [Select]
http://188.138.113.166/index.php
And the php mysql_connect() function works as tested in this .php file
Code: [Select]
http://188.138.113.166/test.php
Using the script

Code: [Select]
<?php
$link 
mysql_connect(&#39;localhost&#39;, &#39;mysql_user&#39;, &#39;mysql_password&#39;);
if (!$link) {
    die(&
#39;Could not connect: &#39; . mysql_error());
}
echo &
#39;Connected successfully&#39;;
mysql_close($link);
?>

The php script i am trying to run is a php irc bot from
Code: [Select]
http://www.phpbots.orgAnd the mysql.php file which issues the error is like this:
Code: [Select]
http://pastebin.com/PU6wsE57
I have also tried editing the mysql_connect function to be something like the test script i mentioned above, but still get the same error.
Any help?

Thanks in advance
Title: Re: Fatal error: Call to undefined function mysql_connect()
Post by: Avin on August 23, 2011, 06:59:45 AM
Did you tried these steps ?

http://www.somacon.com/p109.php (http://www.somacon.com/p109.php)
Title: Re: Fatal error: Call to undefined function mysql_connect()
Post by: bulletproof.rs on August 23, 2011, 03:08:22 PM
Apparently, when i installed php, only web version has installed, not the client version, too.. I mean, the configs for CLI version was not present, so what I've done, is I've created a symlink from /etc/php5/cgi to /etc/php5/cli and then, i was able to run local php scripts.

So this is solved :)
Mods can lock the topic :) thanks anyway :)