473,795 Members | 2,826 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't get mysql_connect() to work in windows

I thought that I'd try php / mysql on windows 2000. I am running php
5.0.0 and it works fine, except when I try to use mysql functions. I
get:

Fatal error: Call to undefined function mysql_connect() in ...

The documentation is unclear to me. It says that mysql support is now
built in, but it doesn't work. Google searches say that it's not (yet)
built in as of a year ago. Some say that you need to compile it
yourself. I looked into compiling it, but there are a lot of .dsw file
and I'm not sure which one need to be compiled, plus when I did try to
compile one of them, I got an error message about missing header files
and missing .dsp files.

So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.
thanks,
Wilfred

Jul 17 '05 #1
8 2645
Wilfred Johnson wrote:
So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.


Yes you can, but you will have to use the php_mysql.dll from one of the
latest 4.x branches as it is no longer bundled with the release of PHP 5.
JW

Jul 17 '05 #2
On Sun, 1 Aug 2004 14:10:30 +0200, "Janwillem Borleffs" <jw@jwscripts.c om>
wrote:
Wilfred Johnson wrote:
So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.


Yes you can, but you will have to use the php_mysql.dll from one of the
latest 4.x branches as it is no longer bundled with the release of PHP 5.


The OP has pointed out correctly that there's a load of conflicting
information; unfortunately I think you've just added some more :-(
php_mysql.dll is most certainly still bundled.

The release notes say that the _MySQL client library_ (NOT to be confused with
the PHP MySQL extension library php_mysql.dll) is no longer bundled, however
even this does not appear to be true for the Windows binary distribution. (It's
true for the Unix source distribution).

I'm reinstalling 5.0.0 from the .zip file at the moment and trying to work out
exactly what it's got; I'll post later on the results, but so far it looks
like:

(a) php_mysql.dll is included, as expected.
(b) libmysql.dll is included, which is unexpected, as it was alledged to be
removed.
(c) The included php_mysql.dll is an old one from PHP4 that won't load in PHP5.

Point (c) looks very odd, I'm trying to work out what's happened there.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #3
"Wilfred Johnson" <wj****@yahoo.c om> wrote in message
news:f7******** *************** *********@4ax.c om...
I thought that I'd try php / mysql on windows 2000. I am running php
5.0.0 and it works fine, except when I try to use mysql functions. I
get:

Fatal error: Call to undefined function mysql_connect() in ...

The documentation is unclear to me. It says that mysql support is now
built in, but it doesn't work. Google searches say that it's not (yet)
built in as of a year ago. Some say that you need to compile it
yourself. I looked into compiling it, but there are a lot of .dsw file
and I'm not sure which one need to be compiled, plus when I did try to
compile one of them, I got an error message about missing header files
and missing .dsp files.

So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.


MySQL support is not enabled by default on PHP5 on Windows because two MySQL
modules are bundled with the new version, php_mysql.dll and php_mysqli.dll.
You need to enable one or the other in php.ini.

If you're new to PHP, don't use PHP5. Install the more stable, more polished
PHP4.3 releases instead.
Jul 17 '05 #4
On Sun, 01 Aug 2004 13:41:39 +0100, Andy Hassall <an**@andyh.co. uk> wrote:
On Sun, 1 Aug 2004 14:10:30 +0200, "Janwillem Borleffs" <jw@jwscripts.c om>
wrote:
Wilfred Johnson wrote:
So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.


Yes you can, but you will have to use the php_mysql.dll from one of the
latest 4.x branches as it is no longer bundled with the release of PHP 5.


The OP has pointed out correctly that there's a load of conflicting
information; unfortunately I think you've just added some more :-(
php_mysql.dl l is most certainly still bundled.

The release notes say that the _MySQL client library_ (NOT to be confused with
the PHP MySQL extension library php_mysql.dll) is no longer bundled, however
even this does not appear to be true for the Windows binary distribution. (It's
true for the Unix source distribution).

I'm reinstalling 5.0.0 from the .zip file at the moment and trying to work out
exactly what it's got; I'll post later on the results, but so far it looks
like:

(a) php_mysql.dll is included, as expected.
(b) libmysql.dll is included, which is unexpected, as it was alledged to be
removed.
(c) The included php_mysql.dll is an old one from PHP4 that won't load in PHP5.

Point (c) looks very odd, I'm trying to work out what's happened there.


(c) was my fault, I had an older php5ts.dll knocking around. I've sorted that.
PHP 5.0.0 Windows binary .zip distribution includes both the PHP MySQL
extension, php_mysql.dll in the ext/ directory, and a MySQL client library
libmysql.dll in the top-level PHP directory, from MySQL version 3.23.57.

(The official MySQL library filename, and the one that php_mysql.dll is linked
against, is libmySQL.dll, uppercase SQL, however since this is Windows, case
doesn't matter, so the supplied one works fine).

To get MySQL support working:

* Iinstall PHP as normal from the .zip distribution.

* Edit php.ini, setting extension_dir correctly (to the full path to the ext
directory) and uncomment the extension=php_m ysql.dll line.

* Ensure that the top-level PHP directory is on your PATH environment variable
(as seen by your webserver) or copy libmySQL.dll to somewhere that already is
(preferably NOT your Windows directories).

* Start PHP, check phpinfo() and you should see MySQL functions are available.

This works entirely from the PHP 5.0.0 Windows binary .zip distribution with
no additional software required. I've also verified the functions actually work
by connecting to and querying a MySQL database.

Hope this clears up the situation a bit.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #5

There is no php.ini when I unzip the zip file.

There is a php.ini-dist and php.ini-recomended.
Do I copy one of these to php.ini? Which one?

thanks,
Wilfred
On Sun, 01 Aug 2004 14:19:56 +0100, Andy Hassall <an**@andyh.co. uk>
wrote:
On Sun, 01 Aug 2004 13:41:39 +0100, Andy Hassall <an**@andyh.co. uk> wrote:
On Sun, 1 Aug 2004 14:10:30 +0200, "Janwillem Borleffs" <jw@jwscripts.c om>
wrote:
Wilfred Johnson wrote:
So, can you or can you not use mysql fuctions with the windows binary
distribution of 5.0.0? There is a lot of conflicting information out
there.

Yes you can, but you will have to use the php_mysql.dll from one of the
latest 4.x branches as it is no longer bundled with the release of PHP 5.


The OP has pointed out correctly that there's a load of conflicting
information ; unfortunately I think you've just added some more :-(
php_mysql.d ll is most certainly still bundled.

The release notes say that the _MySQL client library_ (NOT to be confused with
the PHP MySQL extension library php_mysql.dll) is no longer bundled, however
even this does not appear to be true for the Windows binary distribution. (It's
true for the Unix source distribution).

I'm reinstalling 5.0.0 from the .zip file at the moment and trying to work out
exactly what it's got; I'll post later on the results, but so far it looks
like:

(a) php_mysql.dll is included, as expected.
(b) libmysql.dll is included, which is unexpected, as it was alledged to be
removed.
(c) The included php_mysql.dll is an old one from PHP4 that won't load in PHP5.

Point (c) looks very odd, I'm trying to work out what's happened there.


(c) was my fault, I had an older php5ts.dll knocking around. I've sorted that.
PHP 5.0.0 Windows binary .zip distribution includes both the PHP MySQL
extension, php_mysql.dll in the ext/ directory, and a MySQL client library
libmysql.dll in the top-level PHP directory, from MySQL version 3.23.57.

(The official MySQL library filename, and the one that php_mysql.dll is linked
against, is libmySQL.dll, uppercase SQL, however since this is Windows, case
doesn't matter, so the supplied one works fine).

To get MySQL support working:

* Iinstall PHP as normal from the .zip distribution.

* Edit php.ini, setting extension_dir correctly (to the full path to the ext
directory) and uncomment the extension=php_m ysql.dll line.

* Ensure that the top-level PHP directory is on your PATH environment variable
(as seen by your webserver) or copy libmySQL.dll to somewhere that already is
(preferably NOT your Windows directories).

* Start PHP, check phpinfo() and you should see MySQL functions are available.

This works entirely from the PHP 5.0.0 Windows binary .zip distribution with
no additional software required. I've also verified the functions actually work
by connecting to and querying a MySQL database.

Hope this clears up the situation a bit.


Jul 17 '05 #6
On Sun, 01 Aug 2004 10:45:13 -0400, Wilfred Johnson <wj****@yahoo.c om> wrote:
There is no php.ini when I unzip the zip file.

There is a php.ini-dist and php.ini-recomended.
Do I copy one of these to php.ini? Which one?


Good point, I didn't mention that step as I just did it out of habit.

Either is fine. I used php.ini-dist (which is more suited for development,
e.g. errors displayed in the output) rather than php.ini-recommended (which is
more suited for production, e.g. errors logged to error log), but the
extension_dir=/path/to/ext and extension=php.m ysql.dll directives are the only
two that are actually relevant to getting MySQL support going.

--
Andy Hassall <an**@andyh.co. uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Jul 17 '05 #7

Great. Now it works. Thanks for your help.
On Sun, 01 Aug 2004 16:06:40 +0100, Andy Hassall <an**@andyh.co. uk>
wrote:
On Sun, 01 Aug 2004 10:45:13 -0400, Wilfred Johnson <wj****@yahoo.c om> wrote:
There is no php.ini when I unzip the zip file.

There is a php.ini-dist and php.ini-recomended.
Do I copy one of these to php.ini? Which one?


Good point, I didn't mention that step as I just did it out of habit.

Either is fine. I used php.ini-dist (which is more suited for development,
e.g. errors displayed in the output) rather than php.ini-recommended (which is
more suited for production, e.g. errors logged to error log), but the
extension_di r=/path/to/ext and extension=php.m ysql.dll directives are the only
two that are actually relevant to getting MySQL support going.


Jul 17 '05 #8
Wilfred Johnson wrote:
Great. Now it works. Thanks for your help.


Great.

But i was wondering, this question is getting repeated a lot. Isn't
PHP.net planning to give more info about that? Why don't they bundle the
mysql client anymore (linux) ? Is it because of MySQL went to GNU (maybe
GPL don't remember). I don't understand why they don't give more info
about all this.

I'm afraid this question is going to be asked a hell lot of times.
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2180
by: philippe Tressard | last post by:
Hi, I've 2 instances of apache 1.3.27 with php 4.2.3 and mysql 3.23.42 running on the same server. The 1st apache listens the port number 80 and communicates with the 1st mysql with the socket /var/mysql/mysql1.sock (i've also defined the port 3306) The 2nd apache listens the port number 8080 and communicates with the 2nd
3
49552
by: photoelectric | last post by:
When trying to run the below script on an apache/1.3.26 with mysql and php I get the following error message: Warning: mysql_connect() : Access denied for user: 'nobody@software-ece.rutgers.edu' (Using password: YES) in /ece/under/group14/public_html/insert.php on line 7 Unable to Select database I have no idea what the cause is, any help would be appreciated. Thanks in advance.
10
5126
by: Alvaro G Vicario | last post by:
I need that my script retrieves data from two different databases so I use mysql_connect() to open two connections. I have only one server, user and password, just two different databases. Simplified, it'd be: $con1=mysql_connect($server, $user, $pass); mysql_select_db($database1, $con1); $res1=mysql_query($sql1, $con1); $con2=mysql_connect($server, $user, $pass);
19
8113
by: Michael | last post by:
Hi, I'm trying to do something which should be very simple - connect to the MySQL database. Here is the call, followed by the error msg. $conn = mysql_connect("localhost", "root", ""); Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /var/www/html/buildhw.php on line 13
3
1578
by: Jim Michaels | last post by:
I am running windows XP and PHP 5.1.2 with the MySQL extension enabled in php.ini. I am using mysql_connect() without any fancy options to connect to MySQL and do some stuff without using mysql_close() at the end, and debugging several files in sequence. I eventually run into C:\prj\quiz\withusers>php taaddtt2grp.php
1
7143
by: Swincher | last post by:
Hey - - -- I upgraded my development machine to PHP5. My pages with the subject function no longer work. I am able to do an ODBC connect to the data files from other programs. I get the error: Fatal error: Call to undefined function mysql_connect() in <file.php> on line 190.
14
7713
by: brett | last post by:
I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php file with <? $dbc = mysql_connect (); ?> When I run the file, I get this error: Fatal error: Call to undefined function mysql_connect() in E:\www \mysite\connecttest.php on line 2
5
2637
by: scorpionbilli | last post by:
Hi, The local mysql server is running on my Macbook. I can access it through the console client: $ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.0.45 MySQL Community Server (GPL)
8
8258
by: Kjell Pettersen | last post by:
Hello! I have installed PHP and MySql 5.0 on Win XP. Database created ok. Installation ok. PHP scripts runs ok. But when I am trying some mysql calls in the script I get an "Error 500" from explorer. // Connect to the database server echo ('Trying to connect to db');
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7540
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
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.