I have been trying to get Moodle installed on my server to evaluate it. I am not very familiar with PHP as I am from the MS .Net realm.
After searching through countless posts and creating a few posts of my own on this forum (thank you to all responders), I was never able to find the precise solution to get past the PHP/DataBase connecting portion of the Moodle install.php.
However, I finally got this to work and I will now document what my particular problems were and how I solved them, in the hope that this may help someone out there.
My Environment: Windows 2003 Enterprise Server, IIS, PHP 5.2.5, MSSQL 2005
The entire crux of the problem is getting PHP to run properly on the IIS server and to get PHP to communicate with MSSQL.
Getting PHP Configured and Running Properly
The biggest problem is that when I installed PHP 5.2.5 I installed it in the default directory of C:\Program Files\PHP. It went through the install ok and IIS recognized the extension just fine giving the impression that all went well with the install. Of course this was not the case. I made changes to the php.ini file as per instructions, but the problem is that the PHP installer configures PHP to look for the php.ini file in the C:\WINDOWS directory, not in the installed directory where it actually is. So I needed to copy the php.ini file to the C:\Windows directory. What’s more (and this is important) is that when you use the PHP Installer to add extensions, it will always modify the php.ini file that is in the install directory and not the one in the Windows directory. So if you make manual changes to the php.ini file in the Windows directory, make sure that you copy the new file back to the PHP install directory and vice versa.
I’m pretty confident that there must be some type of environment variable that can be set to have PHP look for the php.ini file in the PHP install directory, but at this point I’m just trying to get it working to conduct an eval. So if anyone out there knows how to set this, it would probably help out a lot of newbies like myself and make the installation process a little less painful.
I highly recommend installing PHP to a simple directory off of the root such as C:\PHP and NOT in the Program Files directory. It is worth the effort to uninstall PHP from the Program Files directory and reinstalling it in a C:\PHP directory.
I also had to make sure that the extension_dir parameter in the php.ini file was set correctly. Assuming now that PHP has been installed in the C:\PHP directory, if you install any extensions using the PHP Installer, it will create an ext directory (C:\PHP\ext) and place the extension dlls in there. You must make certain that the extension_dir parameter in the php.ini file reflects the correct location (i.e. extension_dir=c:\PHP\ext). Otherwise, PHP will not be able to find the dll files and the extension will not load.
Lastly, when I ran the install.php file to attempt to install Moodle, the page loaded fine and asked me what language I wanted to use. When I clicked Next, I got an error that read “The Website cannot display the page” (HTTP 500). What had happened was the PHP Installer configured the upload_tmp_dir and the session.save_path parameters in the php.ini file to my user specific temp directory. PHP does not have access to this directory and when it needs to use them this error occurs. I fixed this by creating system accessible shared directories and then set these parameters to the appropriate directory (e.g. D:\Share\Temp\php\upload and D:\Share\Temp\php\session respectively). Again, there is probably a better prescribed way of setting up these directories and anyone out there who has a better suggestion, please do so.
Don’t forget that you must restart the web server every time you make a change to the php.ini file in order for the changes to take effect.
As a final note to this post, if you run into similar troubles with PHP, I recommend temporarily turning on the display_errors and the display_startup_errors parameters (i.e. display_errors=On and display_startup_errors=On respectively). Once you’ve solved your problems you should turn these parameters back off.