468,765 Members | 796 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Error using mysql with php4

hello,

I'm using the php4-mysql module with php4 under debian linux (sarge). I
have a script, schedule.php, which runs fine when I invoke it from the
command line, but fails with the error:

Fatal error: Call to undefined function: mysql_connect() in
/local/rivulet/interface/db.php on line 4

when I try to invoke it as a web page (using apache2). As far as I know,
php itself is set up correctly.

The error is in the following insert:

<?php
$db = mysql_connect(SQL_HOST, SQL_USER, SQL_PASSWD);

mysql_select_db(SQL_DATABASE,$db);

?>

The capitalised constants are defined in config.php:

<?php
define('SQL_HOST', 'localhost');
define('SQL_USER', 'rivulet');
define('SQL_PASSWD', '******');
define('SQL_DATABASE', 'rivulet');

define('TMP_DIR','/tmp');
define('NO_PROGRAMME_MESSAGE','To be confirmed');
define('DISPLAY_EMPTY_SLOTS',TRUE);
define('INSTALL_ROOT','/local/radio/');
?>

which is include (require_once) in the script I'm invoking.

does anyone have any clue what might be wrong?

thanks, andy.

--
http://www.niftybits.ukfsn.org/

remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.

Dec 13 '05 #1
4 1596
>>>>> Andy Baxter <ne***@earthsong.null.free-online.co.uk> writes:
hello,
I'm using the php4-mysql module with php4 under debian linux (sarge). I
have a script, schedule.php, which runs fine when I invoke it from the
command line, but fails with the error: Fatal error: Call to undefined function: mysql_connect() in
/local/rivulet/interface/db.php on line 4 when I try to invoke it as a web page (using apache2). As far as I know,
php itself is set up correctly.


I had this problem using sarge too. I got it working by adding
extension=mysql.so to the php.ini in /etc/php4/apache.

Regards,

--
Jim Ottaway
Dec 13 '05 #2
>>>>> Jim Ottaway <j.*******@lse.ac.uk> writes:
> Andy Baxter <ne***@earthsong.null.free-online.co.uk> writes: hello,
I'm using the php4-mysql module with php4 under debian linux (sarge). I
have a script, schedule.php, which runs fine when I invoke it from the
command line, but fails with the error: Fatal error: Call to undefined function: mysql_connect() in
/local/rivulet/interface/db.php on line 4 when I try to invoke it as a web page (using apache2). As far as I know,
php itself is set up correctly.

I had this problem using sarge too. I got it working by adding
extension=mysql.so to the php.ini in /etc/php4/apache.


Sorry, ignore that: I thought that's what I did, but I subsequently
stopped using apache in favour of lighttpd.

The extension=mysql.so gets added right at the very end of the
configuration by the mysql installation, so I didn't spot it;
following my advice actually leads to a duplicate extension error.

Has apache been reloaded/restarted since you installed mysql? That
would pick up the configuration change.

Regards,

--
Jim Ottaway
Dec 13 '05 #3
Jim Ottaway said:
>> Jim Ottaway <j.*******@lse.ac.uk> writes:
>> Andy Baxter <ne***@earthsong.null.free-online.co.uk> writes:
hello,
I'm using the php4-mysql module with php4 under debian linux (sarge). I
have a script, schedule.php, which runs fine when I invoke it from the
command line, but fails with the error: Fatal error: Call to undefined function: mysql_connect() in
/local/rivulet/interface/db.php on line 4 when I try to invoke it as a web page (using apache2). As far as I know,
php itself is set up correctly.

I had this problem using sarge too. I got it working by adding
extension=mysql.so to the php.ini in /etc/php4/apache.


Sorry, ignore that: I thought that's what I did, but I subsequently
stopped using apache in favour of lighttpd.

The extension=mysql.so gets added right at the very end of the
configuration by the mysql installation, so I didn't spot it;
following my advice actually leads to a duplicate extension error.

Has apache been reloaded/restarted since you installed mysql? That
would pick up the configuration change.


You were right the first time - the line you said was in php.ini, but
commented out. Removing the comment fixed it.

Thanks, andy.

--
http://www.niftybits.ukfsn.org/

remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
bin unless notified with [html] or [attachment] in the subject line.

Dec 13 '05 #4
>>>>> Andy Baxter <ne***@earthsong.null.free-online.co.uk> writes:
Jim Ottaway said:

Sorry, ignore that: I thought that's what I did, but I subsequently
stopped using apache in favour of lighttpd.

The extension=mysql.so gets added right at the very end of the
configuration by the mysql installation, so I didn't spot it;
following my advice actually leads to a duplicate extension error.

Has apache been reloaded/restarted since you installed mysql? That
would pick up the configuration change.
You were right the first time - the line you said was in php.ini, but
commented out. Removing the comment fixed it.


Ahh. Hmm. Good!

Regards,

--
Jim Ottaway
Dec 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tetedeiench | last post: by
reply views Thread by charlie | last post: by
6 posts views Thread by David Scribler | last post: by
8 posts views Thread by deko | last post: by
15 posts views Thread by Lawrence Krubner | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.