LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-23-2007, 12:55 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 451

Rep: Reputation: 34
Apache PHP != Command Line PHP?


Hello all,

I'm having a weird problem. When I run php from the command line it appears that the whole set of mysql functions are not available to it. I get this.

Code:
root@server:/home/htdocs/system# php movie_update_listings.php

Fatal error: Call to undefined function mysql_connect() in /htdocs/inc/functions.php on line 370
But I know mysql works on my php scripts when I am using them from Apache over the web. Could anyone shed some light on what is going on?

I am using Ubuntu 6.10 fully up to date with the latest apache php and mysql that is available from the apt-get repos.
 
Old 10-23-2007, 08:34 PM   #2
matthalliday
Member
 
Registered: Jan 2006
Location: Brisbane, Australia
Distribution: Suse, Mandrake, IPCop, Debian, Slackware
Posts: 34

Rep: Reputation: 15
In the conf file, make sure that:

extension=mysql.so

is NOT commented out.
 
Old 10-23-2007, 08:48 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 451

Original Poster
Rep: Reputation: 34
Thanks. I will try that.
 
Old 10-23-2007, 09:21 PM   #4
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Ubuntu Server LTS 14.04.1
Posts: 451

Original Poster
Rep: Reputation: 34
That totally fixed it thanks.

For anyone else who might have similar problems, be sure to edit the "right" php.ini file. I had two on my ubuntu system, so I changed them both heh and then it worked.
 
  


Reply

Tags
apache, command, line, mysql, php, working


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
PHP from command line prabhatsoni Linux - Software 0 08-16-2007 11:37 AM
PHP on the command line? kev000 Linux - General 4 11-28-2006 03:16 PM
[php] accessing command line dtra Linux - Software 1 04-26-2005 07:19 PM
php command line scripts naflan Programming 5 11-09-2004 08:02 AM
php from command line odious1 Linux - Software 4 05-03-2004 12:31 AM


All times are GMT -5. The time now is 02:46 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 Google+: linuxquestions
Open Source Consulting | Domain Registration