Jump to content

PHP5 on IIS6


aspnetguy
 Share

Recommended Posts

Well I have installed PHP before on Apache but this is the first time I have tried on IIS6.I actually have PHP5 working and test pages loading properly but I cannot get the mysql extension to load.I keep getting "undefined function mysql_connect" when testing a connection.I have set the PATH in Envioment Variables, set extension_dir = "c:\php5\ext" in php.ini which is in c:\php5What am I missing or forgetting to do to get MySql working with PHP?

Link to comment
Share on other sites

If you haven't given up entirely, there is another change you may need to make in your php.ini file under 'Dynamic Extensions', and that is to remove the semicolon; from the begining of the ;extension=php_mysql.dll line which apparently loads the extension automatically.The php_mysql.dll file goes into your c:\php5\ext folder and the libmysql.dll file goes into the c:\php5 folder.Well at least they've worked for me on the few occasions I've had to install both PHP & MySQL.

Link to comment
Share on other sites

Guest Tornado_

I've had the same problem some time ago when upgrading the MySQL-software from 4.xx to 5.xx. I've made a installation document for my company describing the steps to set up this server with IIS/PHP5/MySQL5. I'll put here a few lines that should solve your problem.- make sure the correct extensions in php.ini are enabled (mysql or mysqli or pdo)- copy “\php\php5ts.dll” & “\php\libmysql.dll”to “\windows\system32\”- copy “\php\php.ini” to “\windows\”- Restart computerHope this helps

Link to comment
Share on other sites

actually the offical PHP manual recommends copying these files to the mentioned directories because it is somehow incorrect. It says to set up the Enviroment Variable path to find php.ini in C:\php and then setup extensions in php.ini

Link to comment
Share on other sites

Didn't the manual said that you have to add the PHP folder to the PATH, not the path to the php.ini file? In your case, this should be "C:\php5".Also, is IIS configured to launch the php.ini file or does PHP start as a server module, thus trying to find the configuration on it's own? I mean, for Apache, there was a special PHPIniDir directive, but for IIS... I don't know.Is phpinfo() showing that MySQL is enabled? If it shows, yet you keep seeing that error, it might be a problem in the PHP file itself. If it doesn't, I suggest you refer to it for tests, rather then your own test file, until you see that MySQL is enabled.A side note: You should install PHP on a non-system partition(D: for example). That way, when you need to reinstall windows, you won't have to redo your PHP.ini file. At the same time, if you have added PHP's folder to the PATH, you can just re-add it after reinstalling windows and that's it. No need for copying php5ts.dll anywhere or anything. For Apache, I even have a special configuration file which I include in the main configuration. That way, I don't need to go to some weird site if I forget the directives. I just include the configuration file in Apache, and it has PHP support already. I guess IIS might have such feature too.If I have convinced you and you have Apache, then extract PHP in D:\PHP, create a .conf file and add this in it:

ScriptAlias /php/ "d:/php/"AddType application/x-httpd-php .php .php5Action application/x-httpd-php "/php/php-cgi.exe"SetEnv PHPRC "d:/php"LoadModule php5_module "d:/php/php5apache2_2.dll"PHPIniDir "d:/php"

I wish I could have provided the IIS equivalent.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...