LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
  Search this Thread
Old 08-09-2006, 07: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, 03:05 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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, 06: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, 12:21 AM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
php -r "phpinfo();
That's cool, thanks. I wasn't sure you could do that with CLI PHP...
 
Old 08-11-2006, 11:11 AM   #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



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration