Page 1 of 1

mysql_connect working in browser but not in terminal

Posted: Sun Aug 31, 2008 11:58 pm
by jayarajmohan
Hi,

I am using PHP Version 5.2.5 in my server. when i run this code in browser its working fine but when i tried to run this from terminal its shows error.

$dbhost='localhost';
$dbusername='username';
$dbuserpass='paswordl';
$dbname='dbname';

// connect to the mysql database server.
$link_id = mysql_connect($dbhost, $dbusername, $dbuserpass);

Error shown in terminal when do this : php /opt/lampp/htdocs/test.php

X-Powered-By: PHP/4.2.2
Content-type: text/html

<br />
<b>Fatal error</b>: Call to undefined function: mysql_connect() in <b>/opt/lampp/htdocs/test.php</b> on line <b>9</b><br />

Please give your idea to overcome this,,

Re: mysql_connect working in browser but not in terminal

Posted: Mon Sep 01, 2008 4:09 am
by filippo.toso
You should be able to avoid it using the -c parameter to specify the right php.ini file.