Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MYSQL from PHP - Installation on Windows2000 issue

Status
Not open for further replies.

ruffy

Programmer
Oct 1, 2003
72
US
I newly installed on my WIN2000 box PHP 5.2 and MySql 5. The installations went successfully.

I can manipulate Mysql from the command line;
I can run many non-mysql scripts in PHP;
But PHP will not connect to Mysql.

It croaks on mysql_connect();
( Fatal error: Call to undefined function mysql_connect() ).

1) I added PHP to my environmental path;
2) Added PHPRC to my system variables;
3) Put php.ini into Winnt directory;
4) Added libmysql.dll file to the Winnt system32 directory;

but no dice. Would appreciate to hear from some good tek tippers.
.... .... .... .... .... .... .... ....
 
Don't know squat about php on Win, but if it were linux I'd conclude that you don't have MySQL support compiled into a module or otherwise directly into the PHP kit you selected.

D.E.R. Management - IT Project Management Consulting
 
in windows you should just uncomment the relevant extension from the php.ini file. then restart the server.
 
My php.ini file has the following line uncommented:
extension=php_mysql.dll
 
3 things to check for:

First: where does your extension_dir point to,
Second: does the file php_mysql.dll reside there,
Third: Do you also have a libmysql.dll file located in there as well?



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Let's RECAP, because this IS an issue many people will encounter and should not be left stranded.

1) Added c:\php5 to environmental path
2) Added PHPRC as a system variable (pointing to c:\php5 where php.ini sits)
3) Added libmysql.dll file to the winnt\system32 directory;
4) Changes in PHP.ini (that sits in the C:\WINNT dir)
extension_dir = "C:\PHP5\ext"
uncommented --> extension=php_mysql.dll
added extension=php_mysqli.dll (loads the “improved” functions recently added to PHP)
changed doc_root = to doc_root=c:\inetpub\
NOTE:
This last change (doc_root) changed my error message
FROM
"Fatal error: Call to undefined function mysql_connect()..."
TO
"No input file specified"

THEN: Noticed this annotation in a php.net document:
Also, add '.INI' to the FILEEXT Server Variable. Failure to add these could stop the PHP engine being able to find your PHP.INI file, and none of your modifications will be read.

BUT: I don't know how to access the server variables to set FILEEXT

Can you help me out here?
 
are you trying to install as a sapi or a cgi?
 
thinking about it, the next step would be the same come what may.

please run this script
Code:
<?php phpinfo(); ?>

and tell us where the php.ini path points to.
 
oops, pressed submit too early there.

when you have isolated the location of the php.ini file that php is actually using, please make sure that the read permissions on that file are granted to the IUSR_MACHINENAME account or whatever other account you are running the IIS process under. given your doc root issues i suspect that this is not the root of the issue, but is still worth checking.

the doc root should be set with quotes
Code:
doc_root = "c:/inetpub/[URL unfurl="true"]wwwroot"[/URL]

note that the slashes go forward like linux. not mandatory but it does avoid problems.
 
jpadie - You're right about the quotes - but they changed nothing following a reboot.
I think you're wrong about the forward slash because the php.ini file is read by Windows.
 
php parses forward and backward slashes similarly. forward slashes are less prone to errors if you deploy cross-platform and/or use ini_set.

 
jpadie - thanks for your help.
To give you an answer on phpinfo(),
I reran my phpinfo script and, unexpectedly, because my php scripts worked in the past, it came up with the "No input file specified."
So back I went to php.ini and reset doc_root, as it was originally, simply as doc_root = [blank].
Then my phpinfo script worked.
On a whim, I ran my mysql script, and voila - the damn thing worked!
Now I simply have no idea why it didn't work before I made that doc_root change
because that change was my very last one to be made.

Oh well, I'll just count my blessings and move on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top