473,748 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(S QL_HOST, SQL_USER, SQL_PASSWD);

mysql_select_db (SQL_DATABASE,$ db);

?>

The capitalised constants are defined in config.php:

<?php
define('SQL_HOS T', 'localhost');
define('SQL_USE R', 'rivulet');
define('SQL_PAS SWD', '******');
define('SQL_DAT ABASE', 'rivulet');

define('TMP_DIR ','/tmp');
define('NO_PROG RAMME_MESSAGE', 'To be confirmed');
define('DISPLAY _EMPTY_SLOTS',T RUE);
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 1807
>>>>> Andy Baxter <ne***@earthson g.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***@earthson g.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***@earthson g.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***@earthson g.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
68840
by: Randell D. | last post by:
Folks, I feel like pulling my hair out - I tried unsuccessfully over the past few days to install ImagMagick but because of version conflicts and missing libraries I had to give up. I originally choose ImageMagick because I've heard so much about it. I then decided to go with the inbuilt GD tools since I'm using PHP 4.3.3 that I compiled with --with-gd. I can use some of the image functions in PHP so why is this one undefined? What...
0
1809
by: Tetedeiench | last post by:
Hi ! I am currently changing the server for my website, and i make a heavy use of openssl functions. Both servers use PHP4.3.3 with OpenSSL 0.9.6i. I was actually testing with this code, taken out from PHP's documentation :
0
1753
by: charlie | last post by:
Hello, I am trying to compile php-5.0.0b3 on a fedora 1.0 system. I am beginning with the following: charliek 12$./configure \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql --prefix=/usr/local/php5 and it completes with the following: ###################################### BEGIN CONFIGURE OUTPUT +--------------------------------------------------------------------+
1
2088
by: Erik | last post by:
I understand, that PHP4 has a MySQL client built in. I was warned, that this client does not support the MySQL 4.1.1 system, which I installed on my RH9 box end that I need to install that version myself in PHP4. Now how do I install that MySQL client in my PHP4 ? Or is is easier/smarter to use another MySQL version, one that IS supported directly by PHP4 ?
6
2267
by: David Scribler | last post by:
I am trying to use PHPNuke on a linux box but I think PHP does not see the Mysql Server. When I use the test php program I get this error "Fatal error: Call to undefined function: mysql_connect() in /home/david/html/html/test.php on line 3" I am using Debian unstable. Is there some setting I need to look at in the php.ini file?
3
6614
by: Armin Irger | last post by:
Hi, i'am running a debian sarge with the delivered apache2 mysql and php4. The file "mitarbeiter_eingabe.php" gets the data over a html <FORM> and send it to "mysql_mitarbeiter_daten_hinzufuegen.php" to write it in an mysql database. These already worked on php3 and mysql-3 and now on php4 and mysql4 it doesn't work. I can't found any changes between php3 and php4, mysql3 and mysql4 that explained the fact that only empty spaces are...
5
4160
by: Grant Nosbush | last post by:
I have searched the newsgroups and the web trying to solve this problem and just can't get it. Maybe someone will be able to help. I am getting the following error when I try to view a test page in my browser. This test page just reads a table in mysql and outputs the results. Fatal error: Call to undefined function: mysql_connect() in /var/web/public/test.php on line 2 I'm using:
8
7098
by: deko | last post by:
I've just loaded phpMyAdmin on a Debian Linux server with Apache2, MySql5 and PHP5. myserver # dpkg -l | grep php ii libapache-mod-php5 5.2.0-8+etch4 ii libapache2-mod-php4 4.4.4-8+etch2 ii php4-common 4.4.4-8+etch2 ii php5-common 5.2.0-8+etch4 ii php5-gd 5.2.0-8+etch4 ii php5-mcrypt 5.2.0-8+etch4
15
3253
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is on a server that handles a fairly demanding site. The defaults, in php.ini, have all been cranked fairly high: scripts get 180 seconds to run, and they can have as much as 256 megs of RAM. The input for this script is coming from a textarea in...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8252
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.