LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 08-09-2006, 08:04 AM   #1
supritipanda
LQ Newbie
 
Registered: Aug 2006
Posts: 2

Rep: Reputation: 0
Unhappy 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
 
Old 08-09-2006, 04:05 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 58
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.
 
Old 08-09-2006, 07:15 PM   #3
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
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
 
Old 08-10-2006, 01:21 AM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 58
Quote:
php -r "phpinfo();
That's cool, thanks. I wasn't sure you could do that with CLI PHP...
 
Old 08-11-2006, 12:11 PM   #5
supritipanda
LQ Newbie
 
Registered: Aug 2006
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


Reply

Tags
help


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating MySQL - Linux terminal program? jantman Programming 1 07-17-2006 05:46 PM
how do you run a program from terminal? fatbeaver Linux - Newbie 1 04-26-2006 01:41 PM
can i run .php trom terminal samnjugu Linux - Software 6 04-20-2006 08:54 AM
any way to continue using the terminal while any program is being run? g_srinivas Linux - Newbie 6 07-20-2005 09:30 AM
How to run a program on another terminal SharpyWarpy Linux - General 2 02-10-2005 03:09 PM


All times are GMT -5. The time now is 03:47 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration