Author |
|
vortilon
Joined: 18 Nov 2006 Posts: 5
|
Posted: Sat 18 Nov '06 18:53 Post subject: MySQL 4.1.21 and PHP 5.2.0 will not work. |
|
|
Hi All
I have just loaded Apache 2.2.2.3, MySQL 4.1.21 and PHP 5.2.0.
I have read most of the threads but still I have probs.
MySQL runs OK when tested from MySQL Command Line Client and on the services tab of Apache Control Service Monitor the Status = Running.
PHP runs .php files OK too.
Unfortunately I can not get them to run together.
(My PHP is installed on C:\PHP5)
I have made the following changes:
1. Changed the path in environment variable to read C:\PHP5
2. Copied the php.ini – recommended file and re-named it php.ini, located it in C:\PHP5
3. Edited php.ini file, uncommented extension_dir = “C:\PHP5\ext” and uncommented extension = php_mysql.dll
4. The Apache CONF file – httpd.conf has the following added after the list of “LoadModule”s
LoadModule php5_module “C:/PHP5/php5apache2_2.dll”
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir “C:/PHP5”
When I run the following db:
<?php
$conn = mysql_connect("localhost", "username", "password");
$result = mysql_list_dbs($conn);
while($db_data = mysql_fetch_row($result)) {
echo "<b> $db_data[0]</b><br>";
}
?>
I get the following:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\db.php on line 2
Any help would be very much appreciated!!
Thanks |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 18 Nov '06 19:12 Post subject: |
|
|
What happens when you try the script in mysqlinfo.zip from the download page here ?
Steffen |
|
Back to top |
|
vortilon
Joined: 18 Nov 2006 Posts: 5
|
Posted: Sat 18 Nov '06 20:46 Post subject: |
|
|
Hi Steffen
Thanks for your reply.
I am pretty much a novice here, can you expand upon what you mean? How do I run the script in in mysqlinfo.zip ?
Thanks
Paul |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sat 18 Nov '06 23:00 Post subject: |
|
|
Sorry I was a little short in my answer.
Go to the download page http://www.apachelounge.com/download/
Look for mysqlinfo.zip and download
Extract mysqlinfo.zip
Change at top of mysql_info.php your MySQL username, Password and Host
Place the script in you webspace.
Call the script in your brosser by typing http://......../mysql_info.php
Steffen |
|
Back to top |
|
vortilon
Joined: 18 Nov 2006 Posts: 5
|
Posted: Sun 19 Nov '06 0:00 Post subject: |
|
|
Hi Steffen
Thanks for clarrifying that one!
I downloaded the file and ran it as requested.
I got:
php MySQL extension not loaded !!
Check in php.ini if extension=php_mysql.dll is enabled, and that the extension_dir = is pointing to your php/ext folder.
Copy libmySQL.dll from your Mysql/bin folder to c:/windows.
I checked both extensions again in my php.ini file and both OK.
I then copied the libmySQL.dll file into c:/windows.
Still same error message. However I have a confession since starting this thread I have upgraded my MySQL to 5.0.27. Thinking this might help
But no....still the same error message.
(Hope me now upgrading the MySQL hasn't complicated matters!)
Nice programme btw, looks like loads of info on there that I may know what to do with in the future!!
Any more assistance greatly appreciated.
Thanks
Paul |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Sun 19 Nov '06 12:30 Post subject: |
|
|
Check the location of the php.ini which php is using:
At the top of phpinfo: Configuration File (php.ini) Path ........
Steffen |
|
Back to top |
|
vortilon
Joined: 18 Nov 2006 Posts: 5
|
Posted: Sun 19 Nov '06 22:43 Post subject: |
|
|
Hi Steffen
Thanks for your help.
I can't seem to find a file, php.info?
Thanks
Paul |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 20 Nov '06 10:31 Post subject: |
|
|
*g* There is no php.info file
create a file info.php
Code: |
<?php
phpinfo();
?>
|
|
|
Back to top |
|
pips
Joined: 03 May 2006 Posts: 65 Location: Manchester, UK
|
Posted: Mon 20 Nov '06 23:00 Post subject: |
|
|
There is a post in one of the other forums where a user had the same problem as described here.
I also had the same problem, in that the MySQL engine wasn't being loaded.
The fix doesn't make any sense, but it works........ (well it did for me and the other guy too).
In the HTTPD.CONF file, remove the line PHPIniDir="c:\php5", restart Apache and all is well.
Like I say, it doesn't make any sense as to why it works - weird..... |
|
Back to top |
|
vortilon
Joined: 18 Nov 2006 Posts: 5
|
Posted: Sat 25 Nov '06 21:32 Post subject: |
|
|
Hi Pips/James Blond/Steffen
Thanks for your help so far.
I have still got the same problem
Pips, you were right in that the PHPIniDir="c:\PHP5" did at some point start preventing my Apache server from running at all. I removed it and hey presto. However, I think I induced that problem somehow as it was OK before I started making further changes.
The test script mysql_info.php given to me by steffen above still produces:
php MySQL extension not loaded !!
Check in php.ini if extension=php_mysql.dll is enabled, and that the extension_dir = is pointing to your php/ext folder.
Copy libmySQL.dll from your Mysql/bin folder to c:/windows.
I am now using a book called Oscommerce Pro Ed by David Mercer. In this it gives eamples of using the command prompt to access MySql, but it fails at that to.
I'm about to give up and use xampp but I don't want to really.
Any other ideas anyone??
Thanks
Paul |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sun 26 Nov '06 0:19 Post subject: |
|
|
Make sure that extension_dir = "C:/apache2/php/ext/" is right! (don't forget / at the very end of the path). replace C:/apache2/php/ext/ with your path.
secondly check that php_mysql exists in the ext folder |
|
Back to top |
|
acarlotto
Joined: 17 Dec 2006 Posts: 1
|
Posted: Sun 17 Dec '06 23:53 Post subject: |
|
|
Hi guys,
I think that i had souved that problem, the same that i had.
So here came.
I was having this folowin message:
PROBLEM:
WHEN I WAS TRYING TO CONNECT TO MYSQL, THE FOLOWING MESSAGE CAME UP:
" the mysql extension is not loaded" BLA BLA BLA
########################################33
First Solution:
Remember this tracec of code, that we have to include in httpd.conf?
line 1- LoadModule php5_module "C:/php5/php5apache2_2.dll"
line 2- AddType application/x-httpd-php .php
line 3- PHPIniDir "C:/php5" <<<<THIS line IS VERY IMPORTANT
the third line is saying that your php.ini will be placed in the same path of your php5 path root be, so if your directory is , something like "c:\php5" or "c:\php", the php.ini most be in the same path.
So the httpd.conf will look like it::
********************************
LoadModule php5_module "C:/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php5"
And the file php.ini will be replaceed in c:\php5\php.ini
*************************************
#############################
Second solution:
The second solution is coment the third line, and keep the php.ini win c:\windows\php.ini, so the code will be like it.
*************************************
LoadModule php5_module "C:/php5/php5apache2_2.dll"
AddType application/x-httpd-php .php
#PHPIniDir "C:/php5"
And the file php.ini will be replaceed in c:\windows\php.ini
**********************************
##################################
Sorry for my englis, and i whope that i would help you,
any questions just mail´me.
Look my conputer fonfigurations:
Windows xp sp2
Apache 2.2
PHP5.2
Mysql 5 |
|
Back to top |
|