fikri215 Posted June 15, 2007 Share Posted June 15, 2007 I'm using PHP version 5.1.6 and mysql. In my case i tried to run php in commnad line interface, i have no problem to 'echo' simple statement such as "Hello My World". i put this line in my hello.php #!/usr/bin/php <?php echo "Hello My World\n"; ?> and then run this command: [root@anas]# php hello.php Hello My World [root@anas]# But, when i tried to connect to mysql, i added these lines: #!/usr/bin/php <?php echo "Hello My World\n"; $conn=mysql_connect('localhost','root','password'); if(!@$conn) { echo "Connection Refused!"; } else echo "Connection Accepted"; mysql_close($conn); ?> i ran the command: [root@anas]# php hello.php Hello My World PHP Fatal error: Call to undefined function mysql_connect() in /home/anaz/phpcli/truncate.php on line 4 [root@anas]# I try to add run this file in the browser using apache webserver. The peocess was success. I got that error only in PHP CLI. Can anyone help me to identify the problem and make the solution. Link to comment https://forums.phpfreaks.com/topic/55699-php-cli/ Share on other sites More sharing options...
per1os Posted June 15, 2007 Share Posted June 15, 2007 [quote=php.net] Using this option, PHP prints out the built in (and loaded) PHP and Zend modules: $ php -m Type that in and post the output here to make sure mysql is installed correctly. Link to comment https://forums.phpfreaks.com/topic/55699-php-cli/#findComment-275301 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.