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,,
mysql_connect working in browser but not in terminal
Moderator: General Moderators
-
jayarajmohan
- Forum Newbie
- Posts: 16
- Joined: Fri Aug 29, 2008 12:06 am
-
filippo.toso
- Forum Commoner
- Posts: 30
- Joined: Thu Aug 07, 2008 7:18 am
- Location: Italy
- Contact:
Re: mysql_connect working in browser but not in terminal
You should be able to avoid it using the -c parameter to specify the right php.ini file.