April 25, 2024, 11:08:06 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: [SOLVED]Fatal error: Call to undefined function mysql_connect()  (Read 22235 times)

Offline bulletproof.rs

  • New Member
  • Posts: 2
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
« Last Edit: August 23, 2011, 03:08:35 PM by bulletproof.rs »

Offline Avin

  • Linux Learner
  • ***
  • Posts: 54
  • L!nuX
Re: Fatal error: Call to undefined function mysql_connect()
« Reply #1 on: August 23, 2011, 06:59:45 AM »
Did you tried these steps ?

http://www.somacon.com/p109.php

Offline bulletproof.rs

  • New Member
  • Posts: 2
Re: Fatal error: Call to undefined function mysql_connect()
« Reply #2 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 :)