# Trouble getting PHP to use MySQL - Page 2

•  Subject
• Author
• Posted on

## Re: Trouble getting PHP to use MySQL

The point is of course that not all 'packages' come with these files,
version.

R.

## Re: Trouble getting PHP to use MySQL

Richard wrote:

They do if you install the correct package - i.e. if you want to use
MySQL client, you need to install the MySQL client - not just the
server.  And if you want to use it with PHP, you must install a package
with the php_mysql.dll.

And when you upgrade/update, the same is true.

Of course, that takes a modicum of intelligence to understand.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Trouble getting PHP to use MySQL

Sorry Jerry,
there is no mySQL client to install.

For mysql, there is only a ZIP package, and a full installer.
For PHP there is a zip package, and a MSI installer.

For both, there are lots of different versions, so how to tell which
combo's work? Which ones give problems?

I think you are talking about nix packages, but this is about Windows.
No packages exist on Windows, and I have not found any page describing
what works and what doesnt.
If you know of one, please let us all know.

R.

## Re: Trouble getting PHP to use MySQL

[180 useless lines snipped]

Jerry and Richard, both of you *please* learn to trim.

## Re: Trouble getting PHP to use MySQL

Doug,
agreed. I am getting lazy, not good. :(

R.

## Re: Trouble getting PHP to use MySQL

Doug Miller wrote:

You're correct, Doug.  Sorry.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Trouble getting PHP to use MySQL

Richard wrote:

Sorry, Richard, you're wrong (again).  It's all part of the same package
- but you do NOT need to install the server on the system.  You can
install only the client, and access a remote MySQL database.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Trouble getting PHP to use MySQL

I think you dont understand what I say. Let me try again:

The PHP install (the MSI) does not include the mysqllib.dll (as of
version 5)
There is no way to only install the client in any installer for mySQL
that I have seen.
mysql website.

An example of the problem:
Suppose you need to connect to some (remote?) server running Linux
with mySQL server 5.4.3
The local machine has PHP 5.6.7 'installed' from ZIP file.

Now tell me: which version of the mySQLlib.dll do I need, where do I
get it, and how do I get it to work with this PHP version without
breaking my other 8 apps that all need their own versions of this dll?

This is a common scenario, and I am just saying that its easy to get
it wrong.

The suggested "add to path" or "put in "C:\Windows\" is actually
making things more complicated, and are both bad solutions IMHO.

R.

## Re: Trouble getting PHP to use MySQL

Richard wrote:

I understand exactly what you're saying.  And you have no idea what

PHP should NOT be providing a DLL for another product.  They finally got
it right.

Look at the installer for MySQL.  Every one of them allows you to
install only the client.  It's not a separate download - it's an install.

The MySQL client is more than just one dll.

You download a MySQL version and install the client.  MySQL 5.4.3 would
give you the most options; using a lower level may not allow you do do
everything MySQL 5.4.3 can do.  Of course, you could install a higher
level, which won't give you any more options, but will still work.

You only run into a problem if you install a client < 4.2, due to a
major chance in the password hashing algorithm.

It's easy for someone with a modicum of intelligence and knowledge to
get it right.

Please show how to access the DLL if it's NOT in a directory in the PATH
statement.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Trouble getting PHP to use MySQL

....

Please stop the low personal attacks. It's so childish.

That is not what we are discussing here.
The problem to solve is "How to find out which version you need of
what and how to make that one work without breaking things"

Ah wait, you mean under "Custom install"?
Thats not a solution, it only makes a bigger mess.
Did you look at what it does?

Yes, sure. But PHP only needs the dll (as per the docs).
Installing another client (I have already 2 of them) or the wrong
version will make an even bigger mess.
application specific dll's.

....

No, using a wrong dll makes the server crash. You dont WANT to read
it, it seems.
Using an old version will break my applications.

Which version should I now force all apps to use?

Sure Mr. Stuckle. Now fuck off.

PATH? You said to put them in the Windows directory before?

If in the path, then all applications that need the file, use the
After this PATH exercise, all my other PHP installs will use the wrong
DLL (if they dont have their own versions at hand).
It happened to me, and crashed the server.

"Windows system" directories: These contain "Windows system files",
files in there.
This is a classic example of the "DLL hell". One application forcing
others to use its private version of a lib. The Windows-system dir has
been a forbidden place for apps since 2001.

You put it in the application directory, that is where it belongs.

With a combo install of Apache / PHP / mySQL it is not clear who is
responsible, and subsequently, no elegant solution exists.

R.

## Re: Trouble getting PHP to use MySQL

Richard wrote:

No personal attack.  Just a statement of the obvious.

It isn't?  Then why did you bring the subject up?

And I explained how to find it.

Yes, that's how I install all my MySQL installations on Windows servers.
It works great - for those with a modicum of intelligence, that is.

So does any client which uses MySQL - not just PHP.

Only when you screw up your installation.  It works great for anyone
with a modicum of intelligence and understanding.

I didn't say anything about where to put it.  I said IF you put it

And how are applications who need the file going to get it?  Using
different versions of the same DLL in your system is VERY BAD.  But you
obviously don't understand this, either.

Again - I didn't tell you to do it.  I said IF you do it.  Learn to read.

But then that's the level I expect from someone with your level of
intelligence.

It is for anyone who understands what they're doing.

However, as I explained - I do recommend people who have no idea what
they're doing install WAMP.  It is perfect for someone at your level.

Meanwhile, the intelligent people will continue to install what WE want
- not what someone else thinks we should have.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

## Re: Trouble getting PHP to use MySQL

Goodbye Stuckle. Good luck with your life.

R.

## Re: Trouble getting PHP to use MySQL

Richard wrote:

What a nice way to put it...

## Re: Trouble getting PHP to use MySQL

Ah well,
if you have such a small "plassertje", then your problems are big
R.

## Re: Trouble getting PHP to use MySQL

Richard wrote:

I had to look that up. Worth it :-)

## Re: Trouble getting PHP to use MySQL

Each potential MySQL connection deals with a SERVER version and a
CLIENT version (which may be on different machines, and there may
be different versions of MySQL installed).  If client and server are
on the same machine, you almost certainly have the same version of
each.

PHP, the libmysql.dll, and the MySQL client library should match
each other, although an exact match is not necessarily required.
The client libraries do relatively little interpretation of SQL
statements.  If the MySQL client library doesn't match the
php_mysql.dll, you might get undefined symbol errors for new API
routines not present in an older client library.

The MySQL client version and the MySQL server version need to match
within a reasonable range, although MySQL has proven amazingly
resilient in dealing with mismatched server and client versions: I
once had a PHP page that used multiple servers with server versions
3, 4, and 5.  (The main purpose being to migrate data and finally
get rid of the version 3 server).  There have been a few boundaries,
such as changes to the password hash, where older clients couldn't
Generally, if you must have a mismatch, a newer client / older
server is better.

The code that you run should not exceed the capabilities of the
server: don't try to use features the server version you're using
doesn't have.  Usually if you try, you'll just get a syntax error
or some other error message when you try to use nonexistent features.

all the clients that use it, which means you have to upgrade all
the servers that those clients use, ...  You might have to change
everything all at once, company-wide or worse.  Fortunately, that
doesn't happen.

Server-to-server version mismatches are more of a problem if you're
using replication.

## Re: Trouble getting PHP to use MySQL

Martin wrote:

Yes, that error message indicates the MySQL extension module for PHP has

That much is correct.

I find it rather unlikely that this could suffice or be necessary.
But then again, I do not remember having set up MySQL on Windows.

Not even after reboot?

Both was to be expected, see below.

The php_mysql.dll file is the MySQL extension module for PHP; it belongs
into the extension_dir as specified in php.ini or by the PHP default (check
the output of phpinfo() for details).  When in doubt, the official PHP
online manual is the first source of information to look for:

<http://php.net/manual/en/book.mysql.php

The libmysql.dll file is probably the MySQL library for Windows (IIRC I
have never set up MySQL on Windows); it belongs in the directory in which
MySQL expects it.  If it does not work in one of the supposed system
directories after reboot, chances are that

a) the MySQL server is not running (not with that error message, though)
b) you are lacking the required permissions to open a file;
c) MySQL expects it elsewhere;
d) libraries that it depends on are missing;
e) it has not been properly registered in the Windows Registry;
f) the filesystem has been corrupted;
g) your system has been hijacked.

(this is not supposed to be an exhaustive list)

If a), b), or c), you have not RTFM properly.  If d) or e), you have not
installed MySQL properly.  If f) or g), you have greater problems than
MySQL not working in PHP ;-)

When in doubt, the official MySQL reference manual is the first source of
information to look for:

<http://dev.mysql.com/doc/refman/5.0/en/>

PointedEars

## Re: Trouble getting PHP to use MySQL

<snip two similar attempts>

What's important is that "libmysql.dll" is visible in Apache's
PATH environment variable.  On my development machine, I set the
system PATH variable to include my PHP installation directory.

However, "php_mysql.dll", and other extension DLLs, should be in
the directory specified by the "extension_dir" config option in
php.ini.  I ended up using the absolute path to the PHP ext/
directory.

extension_dir = "C:\path\to\php\ext\"

The two libraries are distinct and meant for different purposes.

<snip>

--
Curtis Dyer
<? $x='<?$x=%c%s%c;printf($x,39,$x,39);?>';printf($x,39,$x,39);?>