Page 1 of 2
PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 10:34 am
by clarance
Moved by moderator to Installation and Configuration
Please Help,
I have dug into the Sams Teach Yourself PHP, MySQL and Apache. I have installed everything on my Windows XP machine and I finally have come to the part where I interact between PHP and MySQL. in this book it uses MySQLi and for some reason I keep getting this error message:
Fatal error: Class 'mysqli' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\connection\test.php on line 2
here is my code:
<?php
$myconnect = new mysqli("localhost", "[user]", "[password]", "[database]");
if(mysqli_connect_errno()){
printf("Connection failed: %s\n", mysqli_connect_errno());
exit();
} else {
printf("Host information: %s\n", mysqli_get_host_info(myconnect));
}
?>
I have activated MySQLi in the PHP.ini:
extension=php_mysqli.dll
please if you have some suggestions let me know?
Sincerely,
Bilal Clarance
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 11:09 am
by mmj
If you just activated it you may need to restart Apache.
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 11:23 am
by clarance
thanks for your reply, but I also forgot to mention that I restarted my server. sorry!
Bilal
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 11:32 am
by VladSun
Create a PHP file:
search for
php.ini string and see whether you are editing the right php.ini - i.e. the one used by Apache.
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 12:48 pm
by clarance
thank you, you were right I have been editing the file in the htdoc folder, but it says
Configuration File (php.ini) Path C:\WINDOWS
But just one thing when I go into the C:\WINDOWS folder I can't find the PHP.ini file.
any ideas?
Bilal
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 4:21 pm
by VladSun
Search for
PHPIniDir string in Apache
httpd.conf
Change it to an apropriate file.
On Win server I have:
because the php.ini I want to use is C:/php/php.ini
Re: PHP, Apache and MySQL
Posted: Sun Nov 23, 2008 6:23 pm
by clarance
thanks again for your reply,
but sadly that is the same setting I have in my config file. I am entirely out of reason as to why it should look for the PHP.ini in C:/Windows...? :S
HELP SOMEONE, PLEASE!
Re: PHP, Apache and MySQL
Posted: Mon Nov 24, 2008 3:44 am
by VladSun
Did you restart Apache service?
Re: PHP, Apache and MySQL
Posted: Mon Nov 24, 2008 3:47 am
by VladSun
clarance wrote:thanks again for your reply,
but sadly that is the same setting I have in my config file. I am entirely out of reason as to why it should look for the PHP.ini in C:/Windows...? :S
HELP SOMEONE, PLEASE!
???
Did you change it to the PATH you want it to be?
Re: PHP, Apache and MySQL
Posted: Thu Dec 04, 2008 9:10 am
by clarance
I Have the specified path in my apache config file. If you mean the PATH variables, then yes that has been added also.
Worth mentioning though is that when I load my <?php phpinfo() ?> file from the root server and I look in the 'Loaded Configuration file" it says (none) and I believe that it is supposed to say C:/php/php.ini. I have tried all that I can think off and really need this to work so that i can get back to work at home.
Desperate please help??
Sincerely
A developer in need
Re: PHP, Apache and MySQL
Posted: Thu Dec 04, 2008 12:20 pm
by VladSun
Could you please post the exact text line you said you have in apache config file:
Re: PHP, Apache and MySQL
Posted: Thu Dec 04, 2008 1:53 pm
by clarance
PHPIniDir "C:/php/"
Re: PHP, Apache and MySQL
Posted: Thu Dec 04, 2008 2:14 pm
by VladSun
Do you have a php.ini file in C:\PHP\ ?

Re: PHP, Apache and MySQL
Posted: Thu Dec 04, 2008 3:22 pm
by clarance
yes I do have a php.ini file in C:/php
any other ideas?

Re: PHP, Apache and MySQL
Posted: Fri Dec 05, 2008 3:47 am
by VladSun
Maybe you have a second PHPIniDir line somewhere else in httpd.conf ...