Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 10-23-2007, 12:55 AM   #1
Registered: Oct 2003
Location: Canada
Posts: 697

Rep: Reputation: 47
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.

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
Registered: Jan 2006
Location: Brisbane, Australia
Distribution: Suse, Mandrake, IPCop, Debian, Slackware
Posts: 34

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

is NOT commented out.
Old 10-23-2007, 08:48 PM   #3
Registered: Oct 2003
Location: Canada
Posts: 697

Original Poster
Rep: Reputation: 47
Thanks. I will try that.
Old 10-23-2007, 09:21 PM   #4
Registered: Oct 2003
Location: Canada
Posts: 697

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


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 > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:14 AM.

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