User:Robchurch/Getting PHP 5 on a cheap host
Note: MediaWiki 1.11.0 and up will permit the installer to be accessed via config/index.php5
, which then remembers that .php5
is required as a file extension when parsing PHP 5 files, and will configure the software to work under this environment with no further configuration required.
Cheap hosting providers who provide both PHP 4 and PHP 5 seem to have the lower version set as the default associated with .php files. This can pose problems for MediaWiki users, as our files use a .php extension, and so won't be processed with PHP 5.
This page details two possible solutions.
Change the default handler
editMost of the aforementioned hosts will have PHP 5 set up such that it is possible to override the default handler for .php files on a directory-wide basis using a .htaccess file.
Create a .htaccess file in your wiki directory and add the following line:
AddHandler application/x-httpd-php5 .php
Save the file and reload to see if it's worked. Creating an info.php file which calls phpinfo();
can help to check the PHP version number, as well as general configuration settings (useful for spotting gotchas) and available installed extensions.
Change the file extensions
editIf for some reason the above method doesn't work, then it's likely your host will still allow files with a .php5 extension to run under PHP 5. MediaWiki can be tweaked to use this with a little effort, but watch out when updating, as some of these changes will need to be updated each time.
Installer
edit- Rename config/index.php to config/index.php5
- Edit config/index.php, find the line
<form method="post" action="index.php"...
and change it to readindex.php5
Main software
edit- Rename index.php to index.php5
- Rename thumb.php to thumb.php5
- Rename api.php to api.php5
- (These changes will need to be made again after future updates)
- Edit LocalSettings.php and amend or set the value of
$wgScript
to{$wgScriptPath}/index.php5