473,672 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A PHP/MySQL Connnector Problem

I'm running the zip'd version of PHP (PHP 5.1.2 zip package) downloaded
from here: http://www.php.net/downloads.php. PHP won't connect with
MySQL.
From docs and threads, it seems enabling PHP/MySQL connectivity on a

Windows XP machine requires three configuration edits. These are:

1. In php.ini, enable php_mysql.dll by uncommenting
"extension=php_ mysql.dll".
2. In php.ini, set "extension_ dir" to the folder containing
php_mysql.dll which on my PC is C:/core/web/php512/ext/
3. Windows system PATH. Add ";\%SystemRoot% \core\web\php51 2" which
places libmysql.dll on the PATH.

On my workstation, Apache and PHP are installed in the following
directorys:

C:\Program Files\Apache Group\Apache2
C:\Program Files\Apache Group\Apache2\c onf
C:\Program Files\Apache Group\Apache2\c onf\httpd.conf

C:\core\web\php 512
C:\core\web\php 512\php.ini
C:\core\web\php 512\libmysql.dl l
C:\core\web\php 512\ext
C:\core\web\php 512\ext/php_mysql.dll
C:\core\web\Apa che2\htdocs
C:\core\web\Apa che2\htdocs\hel lo.php

PHP was put into C:\core\web\php 512 in order that phpMyAdmin could be
installed somewhere other than C:\Program Files\Apache
Group\Apache2\h tdocs.

http.conf has the following four changes:

LoadModule php5_module "c:\core\web\ph p512\php5apache 2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:\core\web\ph p512"
DocumentRoot "C:/core/web/Apache2/htdocs"

The workstation is running:
Windows XP Media Center Edition Service Pack 2
Apache 2.0.55
MySQL 5.0.18
PHP 5.1.2 (zip)

Apache works fine; MySQL is running; PHP works okay except it just
won't connect to MySQL.

As noted above, configuration changes were made as per online docs and
discussion threads. I set extension_dir to "extension_ dir =
C:/core/web/php512/ext", uncommented extension=php_m ysql.dll from
php.ini and added "c:\core\web\ph p512" to my PATH (followed by a PC
restart). However, the message "Unable to load dynamic library
'C:/core/web/php512/ext/php_mysql.dll'" continues to appear in the
apache error log when apache is started. Much tweaking of the
extension_dir entry has no effect.

Any thoughts would be greatly appreciated.... .. -Tony

I'm using the zip download of PHP as noted in an earlier post......

From: Tony Marston - view profile
Date: Fri, Dec 24 2004 12:17 am
Email: "Tony Marston" <t...@NOSPAM.de mon.co.uk>
Groups: comp.lang.php

Use the zip download if you want to run PHP as an Apache module as the
msi
version is CLI only. Also be aware that the directory structure with
PHP 5
is different from PHP 4.

--
Tony Marston
http://www.tonymarston.net

"Dick Watson" <littlegreenge. ..@mindspring.c om> wrote in message
news:nC******** *********@newsr ead3.news.pas.e arthlink.net...

Feb 20 '06 #1
6 3272
TonyB wrote:
I'm running the zip'd version of PHP (PHP 5.1.2 zip package) downloaded
from here: http://www.php.net/downloads.php. PHP won't connect with
MySQL.
From docs and threads, it seems enabling PHP/MySQL connectivity on a

Windows XP machine requires three configuration edits. These are:

1. In php.ini, enable php_mysql.dll by uncommenting
"extension=php_ mysql.dll".
2. In php.ini, set "extension_ dir" to the folder containing
php_mysql.dll which on my PC is C:/core/web/php512/ext/
3. Windows system PATH. Add ";\%SystemRoot% \core\web\php51 2" which
places libmysql.dll on the PATH.

On my workstation, Apache and PHP are installed in the following
directorys:

C:\Program Files\Apache Group\Apache2
C:\Program Files\Apache Group\Apache2\c onf
C:\Program Files\Apache Group\Apache2\c onf\httpd.conf

C:\core\web\php 512
C:\core\web\php 512\php.ini
C:\core\web\php 512\libmysql.dl l
C:\core\web\php 512\ext
C:\core\web\php 512\ext/php_mysql.dll
C:\core\web\Apa che2\htdocs
C:\core\web\Apa che2\htdocs\hel lo.php

PHP was put into C:\core\web\php 512 in order that phpMyAdmin could be
installed somewhere other than C:\Program Files\Apache
Group\Apache2\h tdocs.

http.conf has the following four changes:

LoadModule php5_module "c:\core\web\ph p512\php5apache 2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:\core\web\ph p512"
DocumentRoot "C:/core/web/Apache2/htdocs"

The workstation is running:
Windows XP Media Center Edition Service Pack 2
Apache 2.0.55
MySQL 5.0.18
PHP 5.1.2 (zip)

Apache works fine; MySQL is running; PHP works okay except it just
won't connect to MySQL.

As noted above, configuration changes were made as per online docs and
discussion threads. I set extension_dir to "extension_ dir =
C:/core/web/php512/ext", uncommented extension=php_m ysql.dll from
php.ini and added "c:\core\web\ph p512" to my PATH (followed by a PC
restart). However, the message "Unable to load dynamic library
'C:/core/web/php512/ext/php_mysql.dll'" continues to appear in the
apache error log when apache is started. Much tweaking of the
extension_dir entry has no effect.

Any thoughts would be greatly appreciated.... .. -Tony

I'm using the zip download of PHP as noted in an earlier post......

From: Tony Marston - view profile
Date: Fri, Dec 24 2004 12:17 am
Email: "Tony Marston" <t...@NOSPAM.de mon.co.uk>
Groups: comp.lang.php

Use the zip download if you want to run PHP as an Apache module as the
msi
version is CLI only. Also be aware that the directory structure with
PHP 5
is different from PHP 4.

--
Tony Marston
http://www.tonymarston.net

"Dick Watson" <littlegreenge. ..@mindspring.c om> wrote in message
news:nC******** *********@newsr ead3.news.pas.e arthlink.net...

Did you copy libmysql.dll to apache2/bin?

-david-

Feb 20 '06 #2
David Haynes wrote:
Did you copy libmysql.dll to apache2/bin?

-david-


Not necessary if you update the PATH to point to it.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Feb 20 '06 #3
It's looking better......... .......

Copying libmysql.dll to apache2/bin eliminated the "Unable to load
dynamic library
'C:/core/web/php512/ext/php_mysql.dll'" message from the Apache
log...... Now, during a restart of Apache, the log (below) is clean of
startup error messages. (The error in the last line of the log is
coming from the application). The server now appears to be locating
functions in php_mysql.dll.

[Mon Feb 20 08:25:40 2006] [notice] Child 684: Child process is exiting
[Mon Feb 20 08:25:40 2006] [notice] Parent: Child process exited
successfully.
[Mon Feb 20 08:25:45 2006] [notice] Apache/2.0.55 (Win32) PHP/5.1.2
configured -- resuming normal operations
[Mon Feb 20 08:25:45 2006] [notice] Server built: Oct 9 2005 19:16:56
[Mon Feb 20 08:25:45 2006] [notice] Parent: Created child process 4316
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Child process is
running
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Acquired the start
mutex.
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Starting 250 worker
threads.
[Mon Feb 20 08:25:53 2006] [error] [client 127.0.0.1] PHP Warning:
mysql_connect() [<a
href='function. mysql-connect'>functi on.mysql-connect</a>]: Unknown
MySQL server host 'mysql' (11001) in
C:\\core\\web\\ Apache2\\htdocs \\app1\\helloMy SQL.php on line 34

I don't understand why this is now working when the folder containing
libmysql.dll was on the path (see the echo output below); but it's
working so that's good... From a DOS window, echoing the path results
in the output below; the folder ..\php512 appears to be on the path
and this is where libmysql.dll was (and is) sitting..

C:\Documents and Settings\HP_Adm inistrator>echo %PATH%

C:\WINDOWS\syst em32;C:\WINDOWS ;C:\WINDOWS\Sys tem32\Wbem;c:\P ython22;\C:\WIN DOWS\

core\web\php512 ;;C:\PROGRA~1\C OMMON~1\MUVEET~ 1\030625;C:\PRO GRA~1\COMMON~1\ MUVEE
T~1\030625

So, for my PC, one additional step (step 4) is added to the connector
setup procedure:.

1. In php.ini, enable php_mysql.dll by uncommenting
"extension=php_ mysql.dll".
2. In php.ini, set "extension_ dir" to the folder containing
php_mysql.dll which on my PC is C:/core/web/php512/ext/
3. Windows system PATH. Add ";\%SystemRoot% \core\web\php51 2" which
places libmysql.dll on the PATH.
4. Copy php_mysql.dll to ../Apache2/bin.

Thanks for your suggestion.

The next step is to figure out why "mysql" is the wrong name for the
mysql instance on my pc... The php page is bombing here:

$link = mysql_connect(' mysql', 'root', '<password>')
or die('Could not connect: ' . mysql_error());

According to the server information section of MySQL Administrator, the
network name of the MySQL server is localhost.... lets see if changing
mysql to localhost has an effect.....
-Tony

Feb 20 '06 #4
TonyB wrote:
It's looking better......... .......

Copying libmysql.dll to apache2/bin eliminated the "Unable to load
dynamic library
'C:/core/web/php512/ext/php_mysql.dll'" message from the Apache
log...... Now, during a restart of Apache, the log (below) is clean of
startup error messages. (The error in the last line of the log is
coming from the application). The server now appears to be locating
functions in php_mysql.dll.

[Mon Feb 20 08:25:40 2006] [notice] Child 684: Child process is exiting
[Mon Feb 20 08:25:40 2006] [notice] Parent: Child process exited
successfully.
[Mon Feb 20 08:25:45 2006] [notice] Apache/2.0.55 (Win32) PHP/5.1.2
configured -- resuming normal operations
[Mon Feb 20 08:25:45 2006] [notice] Server built: Oct 9 2005 19:16:56
[Mon Feb 20 08:25:45 2006] [notice] Parent: Created child process 4316
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Child process is
running
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Acquired the start
mutex.
[Mon Feb 20 08:25:45 2006] [notice] Child 4316: Starting 250 worker
threads.
[Mon Feb 20 08:25:53 2006] [error] [client 127.0.0.1] PHP Warning:
mysql_connect() [<a
href='function. mysql-connect'>functi on.mysql-connect</a>]: Unknown
MySQL server host 'mysql' (11001) in
C:\\core\\web\\ Apache2\\htdocs \\app1\\helloMy SQL.php on line 34

I don't understand why this is now working when the folder containing
libmysql.dll was on the path (see the echo output below); but it's
working so that's good... From a DOS window, echoing the path results
in the output below; the folder ..\php512 appears to be on the path
and this is where libmysql.dll was (and is) sitting..

C:\Documents and Settings\HP_Adm inistrator>echo %PATH%

C:\WINDOWS\syst em32;C:\WINDOWS ;C:\WINDOWS\Sys tem32\Wbem;c:\P ython22;\C:\WIN DOWS\

core\web\php512 ;;C:\PROGRA~1\C OMMON~1\MUVEET~ 1\030625;C:\PRO GRA~1\COMMON~1\ MUVEE
T~1\030625

So, for my PC, one additional step (step 4) is added to the connector
setup procedure:.

1. In php.ini, enable php_mysql.dll by uncommenting
"extension=php_ mysql.dll".
2. In php.ini, set "extension_ dir" to the folder containing
php_mysql.dll which on my PC is C:/core/web/php512/ext/
3. Windows system PATH. Add ";\%SystemRoot% \core\web\php51 2" which
places libmysql.dll on the PATH.
4. Copy php_mysql.dll to ../Apache2/bin.

Thanks for your suggestion.

The next step is to figure out why "mysql" is the wrong name for the
mysql instance on my pc... The php page is bombing here:

$link = mysql_connect(' mysql', 'root', '<password>')
or die('Could not connect: ' . mysql_error());

According to the server information section of MySQL Administrator, the
network name of the MySQL server is localhost.... lets see if changing
mysql to localhost has an effect.....
-Tony


Probably because the first parameter to mysql_connect() is a server
name, and 'mysql' is not a valid server name.

If you're connecting to the local machine you should use 'localhost'
(and 'localhost' should be in your hosts file). Alternatively, this can
be an ip address - 127.0.0.1 for the localhost.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Feb 20 '06 #5
Yes... That worked.... Using "localhost" did the trick. Now, the
little php test page returns results from mysql. And, even better,
phpMyAdmin ver 2.7 began working once config.inc.php was created and
updated with the right id and password. More checkout is needed, but
phpMyAdmin can now create DBs and browse tables. Things are looking
good.

Thanks for your help.
-Tony

Feb 20 '06 #6
joe
Windows requires a reboot in order for your PATH updates to work....

Feb 21 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6519
by: JL | last post by:
Platform: Linux Red Hat RHEL 3 (and red hat 9) Installed MySQL from source. As a matter of fact, installed all LAMPS from source, and the mysql socket file was arranged in a place other than /tmp/mysql.sock. Let's say, /opt/mysql_root/sock/mysql.sock. Installed DBI without any problem. In /etc/my.cnf there are lines as ----- ----- -----
0
3518
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary form for a number of platforms from our download pages at http://www.mysql.com/downloads/ and mirror sites.
3
1638
by: Kirk Soodhalter | last post by:
Hi, This started as a phpmyadmin problem, but has somehow morphed into a mysql problem. I don't know how to fix it. I am posting the conversation from a php newsgroup since it started there. Thanks for any help you might be able to give. -Kirk Ok, in the midst of fixing this problem I have somehow managed to create
0
519
by: Plymouth Acclaim | last post by:
Hi guys, We have a problem with Dual AMD64 Opteron/MySQL 4.0.18/Mandrake 10 for a very high volume site. We are evaluating the performance on our new server AMD64 and it seems it's slow compared to Dual Xeon/MySQL 4.0.15/RedHat8 and Dual Xeon/MySQL 4.0.18/Mandrake 10. And it seems there are zombie threads. 570 threads in 1 hour and we didn't even use JDBC connection pooling at all. These threads are supposed to be gone within 60...
1
3820
by: Alex Hunsley | last post by:
I am trying to install the DBD::mysql perl module. However, it claims I need mysql.h: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /home/alex/.cpan/Metadata Database was generated on Mon, 29 Nov 2004 16:01:05 GMT Running install for module DBD::mysql Running make for R/RU/RUDY/DBD-mysql-2.9004.tar.gz CPAN: Digest::MD5 loaded ok
1
3628
by: smsabu2002 | last post by:
Hi, I am facing the build problem while installing the DBD-MySql perl module (ver 2.9008) using both GCC and CC compilers in HP-UX machine. For the Build using GCC, the compiler error is produced due to the unknown GCC compiler option "+DAportable". For the Build using CC, the preprocessor error is produced due to the recursive declration of macro "PerlIO" in perlio.h file.
1
4846
by: jrs_14618 | last post by:
Hello All, This post is essentially a reply a previous post/thread here on this mailing.database.myodbc group titled: MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode I was wondering if anybody has experienced the same issues
110
10558
by: alf | last post by:
Hi, is it possible that due to OS crash or mysql itself crash or some e.g. SCSI failure to lose all the data stored in the table (let's say million of 1KB rows). In other words what is the worst case scenario for MyISAM backend? Also is it possible to not to lose data but get them corrupted?
39
5851
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f ISO-8859-1 -t UTF-8 mydb.sql mydb_utf8.sql mysqlCREATE DATABASE mydb_utf8 CHARACTER SET utf8 COLLATE utf8_general_ci;
0
8502
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8943
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8696
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6254
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2836
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1834
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.