The mysqli extention

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Fri Aug 06, 2004 2:46 am

http://php.net wrote: A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL's new features, such as prepared statements.


Ok, good. I've installed apache2, mysql and php5 on my machine now (win xp home). I've tried to connect to my database, but here's the output:

Code: Select all

Fatal error: Class 'mysqli' not found in C:\Programfiler\Apache Group\Apache2\htdocs\mysqli.php on line 3

So how do I enable mysqli on windows?
Vikhammer.com (non-english site)
Down for the moment

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Fri Aug 06, 2004 6:06 am

Same way you enable any extension. Uncomment its line (or add it) in PHP.ini.
Image

User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Fri Aug 06, 2004 7:04 am

If it had been that simple, I've wouldn't asked the question :)

my php.ini wrote:
;Windows Extensions
;Note that ODBC support is built in, so no dll is needed for it.
;
extention=php_mysql.dll
extention=php_mysqli.dll
;extension=libmysqli.dll
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_iconv.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
;extension=php_mysql.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll


and the output of

Code: Select all

<?php

$mysqli = new mysqli;
?>

has always been:

Code: Select all

Fatal error: Class 'mysqli' not found in C:\Programfiler\Apache Group\Apache2\htdocs\mysqli.php on line 3
[
Vikhammer.com (non-english site)
Down for the moment

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Fri Aug 06, 2004 11:21 am

Dabear wrote:

Code: Select all

<?php

$mysqli = new mysqli;
?>


Is this your actual code? The mysqli constructor requires you to pass arguments, like any other function. Try following the example in the documentation.
Image

User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Fri Aug 06, 2004 12:12 pm

Code: Select all

[string host [, string username [, string passwd [, string dbname [, int port [, string socket]]]]]]


This means that you actually don't need to pass any value. But I've tried adding them too-all of them, it didn't work. It still gives me the same output. I'm forced to use php4(with the mysql-commands) now :(
Vikhammer.com (non-english site)
Down for the moment

User avatar
swirlee
Moderator
Moderator
Posts: 2257
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Fri Aug 06, 2004 12:45 pm

Check to make sure PHP is actually finding the extension. Turn error_reporting to E_ALL while you're at it.
Image

User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Fri Aug 06, 2004 1:16 pm

<?php
error_reporting(E_ALL);

print_r(get_declared_classes());

$mysqli = new mysqli('localhost', 'root', '***', 'dvd');
?>
I've checked and doublechecked the extension_dir in php.ini, but still I get this output(note: no mysql class in the array)
output:

Code: Select all

Array ( [0] => stdClass [1] => __PHP_Incomplete_Class [2] => Directory [3] => COM [4] => VARIANT )
Fatal error: Cannot instantiate non-existent class: mysqli in C:\Programfiler\Apache Group\Apache2\htdocs\mysqli.php on line 6

Seriously, I don't know what to do next
:sleep:
Vikhammer.com (non-english site)
Down for the moment

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Sun Aug 08, 2004 11:40 am

have you started the mysql service or installed the service

go into the mysql/bin dir and type: mysqld -install

then go into your services and start the service.

mysql is installed by default you shouldn't be having a problem.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests