Link to home
Start Free TrialLog in
Avatar of johnecollins
johnecollinsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Fatal error Class 'mysqli' not found

The remainder of the error message is the path to one of my PHP classes that uses mysqli

I am perplexed by this because I set the foloowing in my php.ini
extension_dir = "C:\PHP\ext"
extension=php_mysqli.dll
The directory C:\PHP\ext does contain the file php_mysqli.dll

If anybody can help I will be very grateful

I have attached php.ini

Thank you for reading this

Cheers John php.ini
Avatar of Mark Brady
Mark Brady
Flag of United States of America image

Have you installed MySQLi?  you must install it before you can use it as it is not part of php or mysql as a standard install.
http://php.net/manual/en/mysqli.installation.php

Go to the link above and scroll down a short distance for the windows instructions.
I did not know that.  Every single installation of PHP that I have or use came with 'mysqli' installed and it was enabled in most cases.
I think I read somewhere that it is installed in some packages and not in others. I'm not sure about WAMPSERVER but I know in my LAMP installation it is installed and I use it without having to do anything. I could be wrong but it sounds like mysqli is not installed on his machine.
It is possible.  On my Ubuntu machines, I may have installed 'mysqli' myself (thru the package manager) because I would normally do that along with 'mysql'.

See if you have 'libmysql.dll' in your path.  I usually have it in the C:\PHP directory.  Like Ray said, more info here: http://us2.php.net/manual/en/mysqli.installation.php
Avatar of johnecollins

ASKER

Hi elvin66,Ray and Dave,

Thank you all very much for your help with this solution waiting to happen - on the upbeat all of the time ;-)

Dave, I'm with you, in my great wealth of experience - 2 download it run it get going no stress at all now a third of my installations have failed on me, sigh sigh with my newly found experience that the next one will be only 1 in 4 - I've always been an optomist

Elvin66, yours is the sort of comment it is good to receive because it sets you off on the great solution trail

Ray, it's been sooooo long since we last talked

I shall have a read of the information you have sent thank you all very much

John
I just noticed in your original question that you have Apache and the web root installed in directory with spaces in the path.  That can cause problems with some PHP extensions and possibly some Apache modules.  All-in-0ne installations like WAMP and XAMPP make sure they do not do that.
Dave,

Cheers for that, C:\Program Files\ is embedded throughout the system,  but I need to make sure I delimit directory references like that, with quotes. But a good point and somethinng to watch for.

on sitepoint.com I got pointed to a typos page for Kevin Yank's book "BUILD YOUR OWN
DATABASE DRIVEN WEB SITE USING PHP & MYSQL"some of it relating to PHP 5.3, so I am reviewing that at the moment and hope it will help thanks for the thought

John
Ahh yes sitepoint has some excellent books. I bought Luke Welling/Laura Thomson's PHP and Mysql Web Development and it is the most excellent book.
Dear All,

I have tried very hard to try and solve this and searched a lot of places and if you google Class 'mysqli' not found there are or have been many people trying to overcome this problem.
Could i ask one of you to try something for me because I am away from and I don't have access to a windows php/apache/mysql machine that I know worked - the problem appears to be PHP 5.3 not built with mysqli extensions. If you have something that works could you please run phpinfo() in a page and see if there is a reference to mysqli in phpinfo() output.

this may generate some clues about what to do

Thank you very much

Off to bed now need  a rest from it now

Cheers for now

John
This is from my XAMPP install with PHP 5.3.5.
XAMPP-phpinfo.jpg
More info here: http://dev.mysql.com/downloads/connector/php-mysqlnd/ 

"The MySQL native driver for PHP is an additional, alternative way to connect from PHP 5.3 or newer to the MySQL Server 4.1 or newer. It is a replacement for the libmysql, the MySQL Client Library. As of PHP 5.3 you can use ext/mysql, ext/mysqli and PDO_MYSQL either together with libmysql as you did in the past or with mysqlnd."
Dave,

Good morning, thank you for running that it has given good clues about what I can expect when it works and some alternatives as well.

Cheers

John
Did you install PHP by itself or in one of the all-in-one installations like WAMP or XAMPP?
Dave,

I have read the doc and it looks very interesting , there's mynext step after breakfast

Once again thanks

John
Hi All,

I have been trawling the net and not progressed ar all.

I said to myself smile it can't get any worse. I did and it did, netbeans 7.0.1 now won't run the PHP scripts even the one that has no MySQL. Oh dear

I shall have to try another question

John
XAMPP is one of the recommended ways to use Netbeans: http://netbeans.org/kb/docs/php/configure-php-environment-windows.html
ASKER CERTIFIED SOLUTION
Avatar of Mark Brady
Mark Brady
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
elvin66,

I am long past being sensible but I will draw the line before I install Linux  -- er this weekend that is ;-)

I had downloaded Apache, MySQL and PHP so I am admitting defeat and uninstalling those.

You mention XAMP  I can only find WAMP should worry ??

I am on Windows XP btw

John
Absolutely not! WAMP is for windows installation only and XAMP is for MAC installation so I use UBUNTU which uses LAMP or LAMPSERVER. If you are using windows you need to install the WAMP package. that will install Apache server, PHP, MYSQL and PhpmyAdmin all in one install. You should be able to use mysqli straight out of the box once you install this full package.

Settingup
Php, Mysql, and Apache all separately takes a lot of configuration and that could be where you are having problems. The installer for WAMP will install all of these packages for you in one hit and should ask you to set a root password and a couple of other questions. It's very easy to setup and get running. Once installed, it will put Wampserver into your task tray so you can click on it to open the mini-menu. On there it has a link to start all services, you can go to PhpmyAdmin or edit the config settings. You should select the option to start WAMP when windows starts to save you having to select it each time.

So in brief

XAMP = Mac only
MAMP = Mac only - same as XAMP for the most part
LAMP = Linux (Ubuntu and others)
WAMP = Windows only - this is the one you need to download. The link is

http://www.wampserver.com/en/download.php

I would recommend downloading the "alpha" version as it will be very stable with no bugs. If you are feeling lucky and want the absolute latest features then one of the beta versions will be for you but for safety, go with alpha (Wamp Server 2.2a)

If you have any questions installing it just ask. Not that I use windows but I do have a dual boot with Ubuntu and Windows 7 on one laptop and the windows 7 has WAMP server installed. Never have any problems using the server.

Just for fun, and to make some of you MAC users throw up, I also have taken my brand new Mackbook Pro laptop and installed Ubuntu on it on a windows partition so I mainly use Ubuntu for working (developing) and use the Mac for recording (I am a musician/singer/songwriter) so do a lot of recording stuff which the mac is the best in. Just a bit of useless information lol.

Have fun
XAMP = Mac only = Wrong.  

http://www.apachefriends.org/en/xampp.html

For Linux, Windows, Mac OS X, and Solaris.  I have XAMPP on Windows XP here and WAMP on another one.  And Ubuntu 8.04 LTS on two other computers... and and and ....

It is also the one recommended by Netbeans.  http://netbeans.org/kb/docs/php/configure-php-environment-windows.html
And John, you could look at the Netbeans link I posted (3 times).
elvin66,

thanks for the explanation most helpful, everything uninstalled, going for wamp now, will report back

sitepoint is an axcellent site and pointed me at css and javascript courses on learnable so one of these I should learn enough to be able to do something ;-)

Liked your comments about MAC perhaps one of these days I'll  have a go at ubuntu

we'll see

thanks

John
I stand corrected about Xamp - one one of the sites I went to it stated it was for MAX OS hence my comment. However I have not used XAMP on any machine only MAMP, WAMP and LAMP
MAMP is installed on my Mac
LAMP on the mac booted into UBUNTU
WAMP on my windows 7 laptop.

All versions run perfectly and there was no setup issues of major confirguration problems. I also use Netbeans on the mac with MAMP server with no problems.

John, Sitepoint is an excellent source for great learning material and if you can go to your library and borrow a book called "PHP and Mysql Web Development" by Luke Welling you will learn how to setup a server properly and it has a crash course in PHP, a course in MYSQL and loads of other very usefull information. I got more from this book than 2 years reading online tutorials.
Elvin66,

Thanks for the tip on the book when I get back home again I'll search the library.

John
I have decided with the help and support of all three of you to uninstall PHP Apache and MySql and download and install wamp. Otherwisw I can't see me working again as attractive as that sounds, I won't be able to afford to try and learn golf or sit bars chatting to young ladies so I have to work.

I am awarding the points for this question to elvin66, but the other question I have about netbeans to Dave Baldwin, Ray they also serve, who stand and stare - I suspect that I have the quote completely mangled and now it means the complete opposite sigh sigh

So thank you all three of you

John
Thanks
You're welcome and good luck with the install.