This may also work for upgrading earlier versions of Instant Rails to PHP5. There was a guide online I used last time, but I can’t seem to find it. Back up your current Instant Rails directory before upgrading, in case something goes horribly wrong. SVN, Git, or some other version managment system is good as you can go back later and look at what you did to upgrade, and what files actually changed. But backing up is important, even if its just copying and pasting the entire Instant Rails folder.
Here is a run down of what I did this time:
Get PHP5
- Get a copy of PHP5. Just get the zipped folder, using the installer isn’t really necessary and makes the process more mysterious than it should be.
- Make a new folder called php4 in the InstantRails directory (or wherever your php folder lives), and copy the contents of the php folder to php4. This will make backing php5 out easier should you find it necessary.
- Extract your copy of PHP5 to the php folder
Modify Configuration Files
- In the php folder there will be two configuration files of interest. “php.ini-dist” and “php.ini-recommended”. Take a look at them and decide which you want to use. “php.ini-dist” has a warning at the top regarding its intention, ie its suitable for development, but probably the best idea for use in production. Copy these to the “InstantRails/conf_files”, rename the existing php.ini to php.ini.old, and rename the config file you want to use to “php.ini”.
- Backup and then modify “conf_files/httpd.conf”. The basic changes will be:
Replace: LoadModule php4_module "${path}/php/php4apache.dll"
With: LoadModule php5_module "${path}/php/php5apache.dll"
And
Replace: AddModule mod_php4.c
With: AddModule mod_php5.c
Check The PHP Version
- In your public web folder (InstantRails/www) create a file with a .php extension (ie, “version.php”) and put the following code inside:
<html>
<body>
<?php phpinfo(); ?>
</body>
</html>
- Fire up InstantRails, and check that file from a browser. Depending on your setup and what you named the file, it should be at http://localhost/version.php. If everything went ok, you should see a page with info about your system. If you see “PHP Version 5.*” near the top (or something similar; you don’t want to see PHP Version 4.xxx), then it worked. Get rid of the version.php file, or change the extension to keep the whole world from seeing that page and your config info.