473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 2623
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.com>
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.com> wrote in message
news:f7********************************@4ax.com...
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.com>
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.


(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_mysql.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.com>
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.


(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_mysql.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.com> 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.mysql.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.com> 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.mysql.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
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...
3
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'...
10
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....
19
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", ""); ...
3
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...
1
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...
14
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...
5
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...
8
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.