tags:

views:

22

answers:

3

Hi everyone, I have a php script running on centos 5.x When i use a code like

$db->connect();

php script doesn't work.I use php myscript.php and it does nothing. .. .. ..

$db->connect();
echo "Hello world";

when i run above script it does nothing.Nothing means the like this; [root@xxxxxxx update_call_history]# php update_call_history.php {press enter} [root@xxxxxxx update_call_history]#

but if i change the script like this

echo "hello world";

it works.I think my php doesnt run class structured script,Is there any missing module or what. Thanks for advance...

A: 

Make sure that:

  • mysql server is on
  • you have turned on error reporting
  • you are specifying correct credentials
Mike Johnson
mysql server is on,i used ini_set('display_errors',1);error_reporting(E_ALL);at the begining of the script.And what do you mean with correct credentials?
cubuzoa
A: 

If all the information you've been able to gather is "doesn't work" you need to do two things:

  1. Configure your environment to generate and display/log all error messages.
  2. Check the return value of the function calls, test whether it was successful and print the exact error message if not.
Álvaro G. Vicario
is there any possibility for missing php mysql module?
cubuzoa
If your code uses it (your question doesn't even mention MySQL) and it's not available, you should get a *Fatal error: Call to undefined function mysql_whatever* error message somewhere.
Álvaro G. Vicario
my problem was missing module which is called php-mysql.In my class i closed the error message for that reason it didn't display.thank for care
cubuzoa
A: 

php-mysql module wasn't installed so it couldn't connect to database.

cubuzoa