upuaut Posted August 1, 2006 Share Posted August 1, 2006 I'm a little confounded. I have a simple script with a mysql_connect() call.On command line>> php script.phpI getX-Powered-By: PHP/4.0.6Content-type: text/html<br><b>Fatal error</b>: Call to undefined function: mysql_connect() in <b>/home/somepath/lib/opendb.php</b> on line <b>2</b><br>and the script doesn't make any database changes.if I try from a browserhttp://somesite.com/script.phpI get the expected output, and I get back data from tables the script uses and the tables that are expected to update some value do get updated.I created a scrip with phpinfo() in it, I get few mysql entries. I'm sure the connection to db is working since i can read/update tables.what gives? running on linux, php4.0.6, mysql 3.xthanks Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/ Share on other sites More sharing options...
hitman6003 Posted August 2, 2006 Share Posted August 2, 2006 Stupid question, but is the "webserver" and the computer you are executing the code from the command line the same computer? Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67492 Share on other sites More sharing options...
upuaut Posted August 2, 2006 Author Share Posted August 2, 2006 Yes. Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67579 Share on other sites More sharing options...
shoaibi Posted August 2, 2006 Share Posted August 2, 2006 [quote author=upuaut link=topic=102646.msg407822#msg407822 date=1154497077]Yes.[/quote]Walla! is this possible! i wanna have such a computer too!, sorry i was not trying to insult, just really too much surprised. i don't think its possible at all, even try re-installing to contacting the MySQL bug report. Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67585 Share on other sites More sharing options...
upuaut Posted August 2, 2006 Author Share Posted August 2, 2006 sorry, turns out i'm running mysql 4.0.24-standard Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67591 Share on other sites More sharing options...
shoaibi Posted August 2, 2006 Share Posted August 2, 2006 [quote author=upuaut link=topic=102646.msg407838#msg407838 date=1154497854]sorry, turns out i'm running mysql 4.0.24-standard[/quote]i really have no idea what's happening. Then why do you ahve to use it from prompt, can't you just use the script? Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67596 Share on other sites More sharing options...
upuaut Posted August 2, 2006 Author Share Posted August 2, 2006 I tested it at the prompt becuase the output from the browser has 2 empty lines - probably 2 nulls - at the top (before I print any statement), and because I use the output as input to a javascript function.. which is making the behaviour intermittent.regardless, it's baffling me why the script works through the browser, but generates the mentioned error on command line. I'm wondering, what's the plumbing difference between the two?thanks. Link to comment https://forums.phpfreaks.com/topic/16270-mysql_connect-fails-from-cmd-line-but-works-through-browser/#findComment-67645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.