Jump to content

PHP config

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by Brooke Vibber (talk | contribs) at 13:28, 12 August 2003 (opcode caching). It may differ significantly from the current version.

<- MediaWiki architecture

PHP is a web template system that accidentally grew up into a fairly general language. PHP's syntax, capabilities, and execution model bear vague similarities to Perl; scripts are loaded by an "interpreter", compiled to bytecode, and then executed. The PHP interpreter can be run from the command line / CGI-style, or more commonly as an in-process Apache module.

Installation

PHP can be a bitch to install in the traditional way. With modern Apache's dynamic modules, it can be fairly easy though. apxs or something. (more later)

Compile-time options

MediaWiki either needs or wants a number of optional features of PHP that need to be enabled at compile time:

Runtime options

You have to turn on register_globals. If you don't, you'll be confused about why no matter what you click, you only see the main page. :)

Yes, we know it's bad form.

Opcode caching

If running a high-traffic site, it is highly recommended that a system be used to cache the compiled scripts; there are a number of such plugins for PHP, some free, some proprietary. Wikipedia currently uses the ionCube PHP Accelerator, which is free-to-use but not free software. For a totally free solution, there is Alternative PHP Cache, however we had more problems with it.

Fortunately, these all seem to be easy to install as Zend plugins, you just drop in a library and change your php.ini. No fussy recompiling of the entire PHP!

Depending on the cache and options used, you may have to perform a special operation whenever updating script files.