LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   can i run a php program to connect to mysql db 4.0 in terminal (https://www.linuxquestions.org/questions/programming-9/can-i-run-a-php-program-to-connect-to-mysql-db-4-0-in-terminal-472270/)

supritipanda 08-09-2006 07:04 AM

can i run a php program to connect to mysql db 4.0 in terminal
 
I found a solution to run php codes from terminal and it works.Thanks.But when i write a program in php that contains mysql database connection stuffs,and i try to run that from terminal,but it gives me error as following :-
Call to undefined function: mysql_connect() in /home/supritip/public_html/test

bulliver 08-09-2006 03:05 PM

Quote:

Call to undefined function: mysql_connect()
Sounds like your PHP does not have MySql support. You must either rebuild it, or you may be able to use PEAR DB.

xhi 08-09-2006 06:15 PM

make a test php page and put a call to phpinfo() in it. you should see there if you have mysql support.

or you could try this..
php -r "phpinfo();" | grep MYSQL

bulliver 08-10-2006 12:21 AM

Quote:

php -r "phpinfo();
That's cool, thanks. I wasn't sure you could do that with CLI PHP...

supritipanda 08-11-2006 11:11 AM

Hi,
Thanks for all your suggestions.
yes i have downloaded CLI and also installed.The problem is that inside php it creates another php.ini,which is used when i run php samples from commend prompt.And in that php.ini mysql support was not there.Also when i locate php.ini in terminal it is not showing that php.ini resides in that cli folder.Any way i find it and set mysql support for php on and it works.Its great that i found this myself.And i m very happy.
Still thanks for all your help.I m happy that so many people replied to my question.:)


All times are GMT -5. The time now is 07:12 AM.