Manually Install Multiple PHP versions on WampServer

Source: Internet
Author: User

WampServer is a software integrated with PHP/Mysql/Apache and other applications (such as PhpMyAdmin/Xdebug [maybe not]). It has its favorite features, it does not simplify the installation and configuration of Php, Mysql, and Apache, but allows us to switch between different installed versions of PHP, Mysql, and Apache with just a few clicks. PHP programmers are most confused about the needs of different PHP versions.

 

Wampserver version menu (Apache, PHP, and MySQL each have a version menu), there is a get more... connect and click it to download the required version on the official website. The installation is automated and simple. However, until I write this article, php5.2 on the official website can be up to 5.2.11, and php5.3 can be up to 5.3.1. 5.2 The latest 5.3.8 of 5.2.17 and 5.3 are not provided, and the update is very slow. What if we don't have the required version? Uncle Mao said a famous saying: Do it yourself and enjoy yourself!

 

To manually install the new PHP version, follow these steps:

  1. Download the PHP version to be installed. Since WampServer is used, of course it is to download the ZIP package of the Window version: http://windows.php.net. DecompressWamp installation directory \ bin \ PHP \ php5.2.17. Take 5.2.17 as an example.
  2. EnterWamp installation directory \ bin \ PHP \ php5.2.17Directory, which is copied from php. ini-dist or php. ini-recommended and renamedPHP. iniTo modify the php. ini configuration (such as extension_dir), copy one point from php. ini, and rename itPhpforapache. ini.
  3. Copy a copy of wampserver. conf from the existing version directory. For example, php5.3.0 already exists when I install WampServer.Wamp installation directory \ bin \ PHP \ php5.3.0Directory ReplicationWampserver. confToWamp installation directory \ bin \ PHP \ php5.2.17.
  4. Modify the Wamp configuration file: EnterWamp installation directory, Open wampmanager with IDE or notepad (preferably a notepad located by a row number, such as EditPlus. ini, locate row 335, usually in this line is [phpVersion], if not, look nearby. Copy the following row: Type: item; Caption: "5.3.0"; Action: multi; Actions: switchPhp5.3.0
    Insert to the beginning of this line and modify it

    Type: item; Caption: "5.2.17"; Action: multi; Actions: switchPhp5.2.17

    Copy again

    [SwitchPhp5.3.0]
    Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
    Action: run; FileName :"Wamp installation directory/Bin/php/php5.3.0/php-win.exe "; Parameters:" switchPhpVersion. php 5.3.0 "; WorkingDir :"Wamp installation directory/Scripts "; Flags: waituntilterminated
    Action: run; FileName :"Wamp installation directory/Bin/php/php5.3.0/php-win.exe "; Parameters:"-c. refresh. php "; WorkingDir :"Wamp installation directory/Scripts "; flags: waituntilterminated
    Action: Run; filename: "Net"; parameters: "Start wampapache"; showcmd: hidden; flags: waituntilterminated
    Action: resetservices
    Action: readconfig;

    Before inserting this section, change it to [switchphp5.2.17]
    Action: Service; Service: wampapache; serviceaction: Stop; flags: ignoreerrors waituntilterminatedaction: Run; filename :"Wamp installation directory/Bin/PHP5.2.17/Php-win.exe "; Parameters:" switchPhpVersion. php5.2.17"; WorkingDir:
    "Wamp installation directory/Scripts "; Flags: waituntilterminated
    Action: run; FileName :"Wamp installation directory/Bin/php5.2.17/Php-win.exe "; Parameters:"-c. refresh. php "; WorkingDir :"Wamp installation directory/Scripts ";
    Flags: waituntilterminated

    Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
    Action: resetservices
    Action: readconfig;

  5. Log out of wampserver and restart. Complete.

You can install any version of PHP in these five steps.

An example of two files is attached:

1. Wamp installation directory \ bin \ PHP \ php5.2.17 \ wampserver. conf, which is actually a PHP File

<? PHP

$ Phpconf ['phpinidir'] = '.';
$ Phpconf ['phpedir'] = '.';
$ Phpconf ['phpconffile '] = 'php. ini ';

$ Phpconf ['apache'] ['1. 3'] ['loadmodulename'] = 'php5 _ module ';
$ Phpconf ['apache'] ['1. 3'] ['loadlelefile'] = 'php5apache. dll ';
$ Phpconf ['apache'] ['1. 3'] ['addmodule'] = 'mod _ php5.c ';

$ Phpconf ['apache'] ['2. 0'] ['loadmodulename'] = 'php5 _ module ';
$ PhpConf ['apache'] ['2. 0'] ['loadlelefile'] = 'php5apache2. dll ';
$ PhpConf ['apache'] ['2. 0'] ['addmodule'] = '';

$ PhpConf ['apache'] ['2. 2'] ['loadmodulename'] = 'php5 _ module ';
$ PhpConf ['apache'] ['2. 2'] ['loadlelefile'] = 'php5apache2 _ 2. dll ';
$ PhpConf ['apache'] ['2. 2'] ['addmodule'] = '';

?>

 

2. Wamp installation directory \ wampmanager. ini

[Phpversion ]
; Wampphpversionstart
Type: item; caption: "5.2.17"; Action: Multi; Actions: switchphp5.2.17; glyph: 13
Type: item; caption: "5.3.0"; Action: Multi; Actions: switchphp5.3.0
Type: separator;
Type: item; caption: "get more... "; Action: Run; filename:" C: \ Program Files (x86) \ Mozilla Firefox \ firefox.exe "; parameters:" http://www.wampserver.com/addons_php.php ";
[Switchphp5.2.17 ]
Action: Service; Service: wampapache; serviceaction: Stop; flags: ignoreerrors waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.2.17/php-win.exe"; Parameters: "switchPhpVersion. php 5.2.17 "; WorkingDir:" D:/programs/wamp/scripts "; Flags: waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.2.17/php-win.exe"; Parameters: "-c. refresh. php "; WorkingDir:" D:/programs/wamp/scripts "; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
[SwitchPhp5.3.0 ]
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe"; Parameters: "switchPhpVersion. php 5.3.0 "; WorkingDir:" D:/programs/wamp/scripts "; Flags: waituntilterminated
Action: run; FileName: "D:/programs/wamp/bin/php/php5.3.0/php-win.exe"; Parameters: "-c. refresh. php "; WorkingDir:" D:/programs/wamp/scripts "; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;

; WAMPPHPVERSIONEND

 

If you want to copy the above files, change the version number and path.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.