Sunday, January 11, 2009

Installing Joomla onto Vista, IIS7 with PHP5.2 and MySQL 5

Recently I have had to take a serious look at Joomla as a CMS development platform. I normally use and develop with Dotnetnuke as my primary CMS.

Just recently I had a request to to offer some help on a half finished project. A Joomla based . This would be a nice contract for me as it would fill a few holes in the financial area at the moment.

So after downloading Joomla I proceeded to install Joomla onto my Vista business machine.

The Joomla requirements as stated on their website is:

  • Apache 1.x or2.x
  • PPH 4.3 or up
  • MySQL 3.23 or up
  • IIS 6 and up (Joomla is optimized for Apache, but also runs on Microsoft IIS (though not officially supported)

Seeing that I already had PHP 5.2 and MySQL 5 and Apache 2, all I needed was the Joomla installation.

This was a relatively easy download and the install is very simple. You get a zipped file which you extract to a folder of you choice. The recommendation is in the web root, but I really don’t like doing it like this. So I created a folder on my d drive extracted it.

I then created a website in IIS7 pointed it to the Joomla folder.  I know I had Apache, but I wanted it to work with IIS7.0. I Added the local IP address, 127.0.0.1 to the hosts file. I have proxy setting in my browser so I had to add the my local Joomla address to the excluded addresses for the proxy.

Fairly simple right, I thought we could just brows to the site and it should work. Not so. I got an error message about php not having a interpreter. Which I could understand

After some digging around on the net, I found out that you need FastCGI in order to run Joomla. For Joomla to work correctly with IIS it is necessary to install an update for IIS FastCGI module for IIS More information about the update is available here.

Apparently FastCGI is preinstalled if you have Vista SP1 and IIS7.0, but for IIS 6 you have to install the FastCGI module. I downloaded it just in case.

You can add the CGI feature by going to Control Panel -> Programs and Features -> Turn Windows features on or off. This enables both the CGI and FastCGI services. If it is already check, it was suggested that I uncheck it, restart vista, then recheck it to add the feature back again and restart Vista. I did this, but when trying to browse to the Joomla Site I still got errors.

Eventually I followed the tutorial found on IIS.net site, here. But still could not get the Joomla site to run. I figured it must be the FastCGI module setting. SO I browsed to this page and went over the steps time and time again. No joy. For some reason I could not get the FastCGI module to show up in the Module Mapping.

I then found a little note on this same page as to why I could not see the FastCGI module in the Mapping. SO I followed what it said. Here is is:

NOTE: If you do not see "FastCgiModule" in the "Modules:" drop-down list then it means that the module is not registered or not enabled.

To check if FastCGI module is registered open the IIS configuration file %WINDIR%\windows\system32\config\applicationHost.config and check that the following line is present in <globalModules> section:

<add name="FastCgiModule" image="%windir%\System32\inetsrv\iisfcgi.dll" />

Also, in the same file, check that the FastCGI module is added to the <modules> section:

<add name="FastCgiModule" />

Still I could not get it to work. I eventually saw the command line option to enable Fast CGI and Tried that.

Using command line

Alternatively, the above mentioned steps can be completed by using command line tool appcmd.

To create the FastCGI application process pool, run the following command:

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='c:\{php_folder}\php-cgi.exe']

After that, create the handler mapping:

C:\>%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='c:\{php_folder}\php-cgi.exe',resourceType='Unspecified']

After once again carefully going through the steps found on this site, making sure I made all the changes to the PHP.ini file and any other configuration files. I browsed to my Joomla site, and viola it worked I got the Joomla installation screen. Now I can proceed to step 2.

I managed to go through all the set up steps up to the database point. There you had an option to include sample data. This is so that you don’t have a blank site and have to start from scratch entering in content. So I opted for the Sample data. But when clicking the sample data button, I was presented with a error stating that there was a problem in the XML file. Oh drat here we start again.

After more digging around I found that the scripts to create the database and insert the data was in the installation folder on the Joomla install. You will find them here “[Joomla]\installation\sql\mysql”

So what I opted to do is skip the sample data and run the sql script. The only thing is that you have to edit the sql script to replace all “#_” with “jos_” or what ever table prefix you choose. Run the scripts and your data is there in MySQL.

All it needed was now to finish the Joomla Installation and I was away. Not to be. More errors. This time I got this error “Fatal error: Call to undefined method JException::getNullDate()” Now what?

After some more digging around I found that the configuration.php file was not be created and written to properly. This was probably a permissions issue. But by now I had had enough. It was 01h00 in the morning, I had been at this for a few hours now. So the suggestion I found was to create a blank configuration.php file. I did this and went through the whole installation setup again.

But still no joy. What now I was bout to through this thing out the window. It seemed to me that windows installers where so much easier. Everything was done for you. Not here.

I figured out that this php configuration file was being written to and all that it was doing was writing the php variables for the Joomla installation. Things like IP addresses, database logins etc. This was what the step by step set up was supposed to be doing.

So I went to the Joomla site and found a step by step procedure to do a manual installation. You can find this here.

After following this manual procedure step by step. Making sure I had all the correct values, like database name, user name and passwords, etc etc. I finally with bated breath browsed to my local Joomla site. But still got an error stating that I had to delete the installation folder. Well that was simple enough. Seeing that I was doing a manual installation, I deleted the installation folder from the Joomla root.

Browsed once again to the local Joomla site and surprise surprise it WORKED! I was elated and glad. All the tension drained from me.

I got up from my seat and was immediately followed with a excruciating headache. But that's another matter ….

What were your installation nightmares like? Or did the installation go smoothly? Do you have any stories to tell or comments to make? Drop us a note.

del.icio.us Tags: ,,,

4 comments:

opensourcesociologist said...

Actually having to delete the installation folder is part of a normal Joomla! install. It is required for security reasons. There is a good installation manual available, though safe to say that it won't cover all your adventures since IIS isn't officially supported.

http://help.joomla.org/content/category/48/268/302/

Website design, web development, web hosting and Search Engine Optimization
Roberto said...

I've installed Joomla on and XP Pro MAchine, with IIS 5.1, PHP 5.2 (ISAPI) and MySQL 5.1, i got some troubles with PHP.ini, but after several tries it worked fine, at least for the phpinfo point of view, the Joomla install went just fine, and the final "status" info also showed it was fine. From the installation point of view (since it was my first Joomla install EVER), with a few guides (PHP via ISAPI, Joomla on IIS) and a few tweaks it worked... now im going live, and im searching if FastCGI in IIS 6 (Win2003 server) is faster/more reliable than ISAPI, but no "direct" answer so far...

Website design, web development, web hosting and Search Engine Optimization
mozoella said...

That was quite an ordeal programmer,but i think installing joomla manually is the best bet. You can use a joomla manual or guide. And like 'opensourcesociologist' said, deleting the installation folder is part of a normal joomla install.VPS Hosting

Website design, web development, web hosting and Search Engine Optimization
stocks fan said...

This is a great and informative article for Joomla Developers.

Website design, web development, web hosting and Search Engine Optimization