MySQL doesn't work with PHP5

I have already posted regarding this problem in the MySQL database forum on this website. Since then I have uninstalled Apache 2.2, PHP 5.2 and MySQL 5.1 and reinstalled them all. I still cannot access the database by PHP script. I have already been warned about posting a link to website so you would have to look at my aforesaid previous posts to see it for yourself: it is a user authentication script, it is coded properly, the problem is that as of PHP5 there no longer includes support for MySQL. I have done everything to try and make it work: everything is in the path, php.ini is configured properly, phpinfo(); shows PHP is installed properly but under Modules it lists nothing. I can run other php scripts/functions, only I cannot connect to the database: Fatal error: Call to undefined function mysql_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\register-exec.php on line 15.
Understand, please, it does this with any script that tries to connect to the database. If you aren’t aware of the hassle with PHP5/MySQL, then you probably aren’t going to be able to help BUT SOMEBODY OUT THERE MUST HAVE EXPERIENCE WITH THIS MATTER.

OK, I have managed to get it working properly. Here is what is necessary.
First, for whatever reason, PHP omitted a critical file for MySQL support from their PHP 5.3.2, so I would use that one at all: I used PHP 5.2.8–and you have to download it twice! once with the installer and once as a zip file–because the installer version doesn’t have all the files required for MySQL support in it. Install PHP as usual, into say C:\PHP , oh so easy, andunzip the zip file to wherever you like, copy everything (just makes it easy and doesn’t hurt to include everthing) into the “ext” file, and then copy the ext file and paste in C:\PHP. In the php.ini file make an entry like this:
;
extension_dir = C:\PHP\ext

libmysql.dll should be copied–not moved–into C:\PHP and also to Windows\system32.

I can’t believe how long I worked at this—sheesh.

So then, Apache 2.2, PHP 5.2.8 and MySQL 5.1 on Windows 7.

Praise be to the powers that be–and fk Oracle for screwing up a good thing.

Sponsor our Newsletter | Privacy Policy | Terms of Service