How to install Composer on Debian / Ubuntu Linux

How to install Composer on Debian / Ubuntu Linux

When‘i’m trying to upgrade my Mediawiki installation and I’m getting an error that read as follows:
Error: your composer.lock file is not up to date, run “composer update” to install newer dependencies
How do I install composer command for my PHP installation on Debian or Ubuntu Linux running LAMP or LEMP stack? How do I Install and use Composer on running Ubuntu Linux server and fix this problem for mediawiki installation and/or manage and install PHP packages and dependencies for my project?

Composer is a dependency manager tool for PHP. It installs and updates the libraries for your project. It is not a package manager like or . It is desgined to use with each individual project like Mediawiki or your own custom app written in PHP. There are many open source projects and frameworks written in php use Composer to manage and install their packages and dependencies. In this tutorial you will learn how to install composer globally on Debian or Ubuntu Linux server. The following instructions should also work with RHEL/CentOS Linux 7.x or any other modern Linux distro.

The problem

When you try to update mediawiki to v1.26.0 using the following command:
[[email protected]:~/wiki]$ php update.php
You will will get the following error:

MediaWiki 1.26.0 Updater
  composer/semver: not installed, 1.0.0 required. liuggio/statsd-php-client: 1.0.12 installed, 1.0.16 required. oyejorge/less.php: not installed, 1.7.0.9 required. mediawiki/at-ease: not installed, 1.1.0 required. oojs/oojs-ui: 0.11.3 installed, 0.12.12 required. wikimedia/assert: not installed, 0.2.2 required. wikimedia/cdb: 1.0.1 installed, 1.3.0 required. wikimedia/composer-merge-plugin: 1.0.0 installed, 1.3.0 required. wikimedia/ip-set: not installed, 1.0.1 required. wikimedia/utfnormal: 1.0.2 installed, 1.0.3 required. wikimedia/wrappedstring: not installed, 2.0.0 required. zordius/lightncandy: 0.18 installed, 0.21 required. Error: your composer.lock file is not up to date, run "composer update" to install newer dependencies

To fix this problem you need to install the composer tool.

Installation

Make sure curl and php-cli, curl and related tools are installed on your Debian or Ubuntu server (14.04 LTS or older):
$ sudo apt-get install curl php5-cli git
Sample outputs:

Reading package lists... Done Building dependency tree        Reading state information... Done php5-cli is already the newest version. The following extra packages will be installed:   git-man libcurl3 liberror-perl patch rsync Suggested packages:   gettext-base git-daemon-run git-daemon-sysvinit git-doc git-el git-email   git-gui gitk gitweb git-arch git-bzr git-cvs git-mediawiki git-svn ed   diffutils-doc openssh-server The following NEW packages will be installed:   curl git git-man libcurl3 liberror-perl patch rsync 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 4,011 kB of archives. After this operation, 23.4 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libcurl3 amd64 7.35.0-1ubuntu2.5 [173 kB] Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main rsync amd64 3.1.0-2ubuntu0.1 [283 kB] Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main curl amd64 7.35.0-1ubuntu2.5 [123 kB] Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main liberror-perl all 0.17-1.1 [21.1 kB] Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9.1-1ubuntu0.1 [698 kB] Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git amd64 1:1.9.1-1ubuntu0.1 [2,627 kB] Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main patch amd64 2.7.1-4ubuntu2.3 [86.4 kB] Fetched 4,011 kB in 1s (2,181 kB/s) Selecting previously unselected package libcurl3:amd64. (Reading database ... 16719 files and directories currently installed.) Preparing to unpack .../libcurl3_7.35.0-1ubuntu2.5_amd64.deb ... Unpacking libcurl3:amd64 (7.35.0-1ubuntu2.5) ... Selecting previously unselected package rsync. Preparing to unpack .../rsync_3.1.0-2ubuntu0.1_amd64.deb ... Unpacking rsync (3.1.0-2ubuntu0.1) ... Selecting previously unselected package curl. Preparing to unpack .../curl_7.35.0-1ubuntu2.5_amd64.deb ... Unpacking curl (7.35.0-1ubuntu2.5) ... Selecting previously unselected package liberror-perl. Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ... Unpacking liberror-perl (0.17-1.1) ... Selecting previously unselected package git-man. Preparing to unpack .../git-man_1%3a1.9.1-1ubuntu0.1_all.deb ... Unpacking git-man (1:1.9.1-1ubuntu0.1) ... Selecting previously unselected package git. Preparing to unpack .../git_1%3a1.9.1-1ubuntu0.1_amd64.deb ... Unpacking git (1:1.9.1-1ubuntu0.1) ... Selecting previously unselected package patch. Preparing to unpack .../patch_2.7.1-4ubuntu2.3_amd64.deb ... Unpacking patch (2.7.1-4ubuntu2.3) ... Processing triggers for ureadahead (0.100.0-16) ... Setting up libcurl3:amd64 (7.35.0-1ubuntu2.5) ... Setting up rsync (3.1.0-2ubuntu0.1) ...  Removing any system startup links for /etc/init.d/rsync ... update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match rsync Default-Stop values (none)  Adding system startup for /etc/init.d/rsync ...    /etc/rc0.d/K20rsync -> ../init.d/rsync    /etc/rc1.d/K20rsync -> ../init.d/rsync    /etc/rc6.d/K20rsync -> ../init.d/rsync    /etc/rc2.d/S20rsync -> ../init.d/rsync    /etc/rc3.d/S20rsync -> ../init.d/rsync    /etc/rc4.d/S20rsync -> ../init.d/rsync    /etc/rc5.d/S20rsync -> ../init.d/rsync Setting up curl (7.35.0-1ubuntu2.5) ... Setting up liberror-perl (0.17-1.1) ... Setting up git-man (1:1.9.1-1ubuntu0.1) ... Setting up git (1:1.9.1-1ubuntu0.1) ... Setting up patch (2.7.1-4ubuntu2.3) ... Processing triggers for libc-bin (2.19-0ubuntu6.6) ... Processing triggers for ureadahead (0.100.0-16) ...

Reading package lists… Done Building dependency tree Reading state information… Done php5-cli is already the newest version. The following extra packages will be installed: git-man libcurl3 liberror-perl patch rsync Suggested packages: gettext-base git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-bzr git-cvs git-mediawiki git-svn ed diffutils-doc openssh-server The following NEW packages will be installed: curl git git-man libcurl3 liberror-perl patch rsync 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 4,011 kB of archives. After this operation, 23.4 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libcurl3 amd64 7.35.0-1ubuntu2.5 [173 kB] Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main rsync amd64 3.1.0-2ubuntu0.1 [283 kB] Get:3 http://archive.ubuntu.com/ubuntu/ trusty-updates/main curl amd64 7.35.0-1ubuntu2.5 [123 kB] Get:4 http://archive.ubuntu.com/ubuntu/ trusty/main liberror-perl all 0.17-1.1 [21.1 kB] Get:5 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git-man all 1:1.9.1-1ubuntu0.1 [698 kB] Get:6 http://archive.ubuntu.com/ubuntu/ trusty-updates/main git amd64 1:1.9.1-1ubuntu0.1 [2,627 kB] Get:7 http://archive.ubuntu.com/ubuntu/ trusty-updates/main patch amd64 2.7.1-4ubuntu2.3 [86.4 kB] Fetched 4,011 kB in 1s (2,181 kB/s) Selecting previously unselected package libcurl3:amd64. (Reading database … 16719 files and directories currently installed.) Preparing to unpack …/libcurl3_7.35.0-1ubuntu2.5_amd64.deb … Unpacking libcurl3:amd64 (7.35.0-1ubuntu2.5) … Selecting previously unselected package rsync. Preparing to unpack …/rsync_3.1.0-2ubuntu0.1_amd64.deb … Unpacking rsync (3.1.0-2ubuntu0.1) … Selecting previously unselected package curl. Preparing to unpack …/curl_7.35.0-1ubuntu2.5_amd64.deb … Unpacking curl (7.35.0-1ubuntu2.5) … Selecting previously unselected package liberror-perl. Preparing to unpack …/liberror-perl_0.17-1.1_all.deb … Unpacking liberror-perl (0.17-1.1) … Selecting previously unselected package git-man. Preparing to unpack …/git-man_1%3a1.9.1-1ubuntu0.1_all.deb … Unpacking git-man (1:1.9.1-1ubuntu0.1) … Selecting previously unselected package git. Preparing to unpack …/git_1%3a1.9.1-1ubuntu0.1_amd64.deb … Unpacking git (1:1.9.1-1ubuntu0.1) … Selecting previously unselected package patch. Preparing to unpack …/patch_2.7.1-4ubuntu2.3_amd64.deb … Unpacking patch (2.7.1-4ubuntu2.3) … Processing triggers for ureadahead (0.100.0-16) … Setting up libcurl3:amd64 (7.35.0-1ubuntu2.5) … Setting up rsync (3.1.0-2ubuntu0.1) … Removing any system startup links for /etc/init.d/rsync … update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match rsync Default-Stop values (none) Adding system startup for /etc/init.d/rsync … /etc/rc0.d/K20rsync -> ../init.d/rsync /etc/rc1.d/K20rsync -> ../init.d/rsync /etc/rc6.d/K20rsync -> ../init.d/rsync /etc/rc2.d/S20rsync -> ../init.d/rsync /etc/rc3.d/S20rsync -> ../init.d/rsync /etc/rc4.d/S20rsync -> ../init.d/rsync /etc/rc5.d/S20rsync -> ../init.d/rsync Setting up curl (7.35.0-1ubuntu2.5) … Setting up liberror-perl (0.17-1.1) … Setting up git-man (1:1.9.1-1ubuntu0.1) … Setting up git (1:1.9.1-1ubuntu0.1) … Setting up patch (2.7.1-4ubuntu2.3) … Processing triggers for libc-bin (2.19-0ubuntu6.6) … Processing triggers for ureadahead (0.100.0-16) …

If you are using Ubuntu Linux 16.04 LTS or newer and want to use PHP 7.x, run:
$ sudo apt install curl php7.0-cli git

Install composer tool

Next install composer on Debian or Ubuntu Linux in /usr/local/bin/ directory as follows:
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Sample outputs:

Fig.01: Installing composer on your server running Ubuntu Linux

Verify composer

To verify installation type:
$ composer
OR
$ /usr/local/bin/composer
Sample outputs:

   ______   / ____/___  ____ ___  ____  ____  ________  _____  / /   / __ // __ `__ // __ // __ // ___/ _ // ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ / /____//____/_/ /_/ /_/ .___//____/____//___/_/                     /_/ Composer version 1.0-dev (1c525b76f81123af180743d31c208c29351cf931) 2015-12-09 15:47:26   Usage:   command [options] [arguments]   Options:   -h, --help                     Display this help message   -q, --quiet                    Do not output any message   -V, --version                  Display this application version       --ansi                     Force ANSI output       --no-ansi                  Disable ANSI output   -n, --no-interaction           Do not ask any interactive question       --profile                  Display timing and memory usage information   -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.   -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug   Available commands:   about           Short information about Composer   archive         Create an archive of this composer package   browse          Opens the package's repository URL or homepage in your browser.   clear-cache     Clears composer's internal package cache.   clearcache      Clears composer's internal package cache.   config          Set config options   create-project  Create new project from a package into given directory.   depends         Shows which packages depend on the given package   diagnose        Diagnoses the system to identify common errors.   dump-autoload   Dumps the autoloader   dumpautoload    Dumps the autoloader   global          Allows running commands in the global composer dir ($COMPOSER_HOME).   help            Displays help for a command   home            Opens the package's repository URL or homepage in your browser.   info            Show information about packages   init            Creates a basic composer.json file in current directory.   install         Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.   licenses        Show information about licenses of dependencies   lint            Run the lint script as defined in composer.json.   list            Lists commands   phpcs           Run the phpcs script as defined in composer.json.   remove          Removes a package from the require or require-dev   require         Adds required packages to your composer.json and installs them   run-script      Run the scripts defined in composer.json.   search          Search for packages   self-update     Updates composer.phar to the latest version.   selfupdate      Updates composer.phar to the latest version.   show            Show information about packages   status          Show a list of locally modified packages   suggests        Show package suggestions   test            Run the test script as defined in composer.json.   update          Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.   validate        Validates a composer.json and composer.lock

______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ // __ `__ // __ // __ // ___/ _ // ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / /____//____/_/ /_/ /_/ .___//____/____//___/_/ /_/ Composer version 1.0-dev (1c525b76f81123af180743d31c208c29351cf931) 2015-12-09 15:47:26Usage: command [options] [arguments]Options: -h, –help Display this help message -q, –quiet Do not output any message -V, –version Display this application version –ansi Force ANSI output –no-ansi Disable ANSI output -n, –no-interaction Do not ask any interactive question –profile Display timing and memory usage information -d, –working-dir=WORKING-DIR If specified, use the given directory as working directory. -v|vv|vvv, –verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debugAvailable commands: about Short information about Composer archive Create an archive of this composer package browse Opens the package’s repository URL or homepage in your browser. clear-cache Clears composer’s internal package cache. clearcache Clears composer’s internal package cache. config Set config options create-project Create new project from a package into given directory. depends Shows which packages depend on the given package diagnose Diagnoses the system to identify common errors. dump-autoload Dumps the autoloader dumpautoload Dumps the autoloader global Allows running commands in the global composer dir ($COMPOSER_HOME). help Displays help for a command home Opens the package’s repository URL or homepage in your browser. info Show information about packages init Creates a basic composer.json file in current directory. install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. licenses Show information about licenses of dependencies lint Run the lint script as defined in composer.json. list Lists commands phpcs Run the phpcs script as defined in composer.json. remove Removes a package from the require or require-dev require Adds required packages to your composer.json and installs them run-script Run the scripts defined in composer.json. search Search for packages self-update Updates composer.phar to the latest version. selfupdate Updates composer.phar to the latest version. show Show information about packages status Show a list of locally modified packages suggests Show package suggestions test Run the test script as defined in composer.json. update Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file. validate Validates a composer.json and composer.lock

How does composer work?

To use Composer you need to create or use composer.json file supplied by your vendor such as mediawiki. This file defines the dependencies of php app or project. Here is sample file from mediawiki project:

{         "name": "mediawiki/core",         "description": "Free software wiki application developed by the Wikimedia Foundation and others",         "keywords": ["mediawiki", "wiki"],         "homepage": "https://www.mediawiki.org/",         "authors": [                 {                         "name": "MediaWiki Community",                         "homepage": "https://www.mediawiki.org/wiki/Special:Version/Credits"                 }         ],         "license": "GPL-2.0+",         "support": {                 "issues": "https://bugs.mediawiki.org/",                 "irc": "irc://irc.freenode.net/mediawiki",                 "wiki": "https://www.mediawiki.org/"         },         "require": {                 "composer/semver": "1.0.0",                 "cssjanus/cssjanus": "1.1.1",                 "ext-iconv": "*",                 "liuggio/statsd-php-client": "1.0.16",                 "oyejorge/less.php": "1.7.0.9",                 "mediawiki/at-ease": "1.1.0",                 "oojs/oojs-ui": "0.12.12",                 "php": ">=5.3.3",                 "psr/log": "1.0.0",                 "wikimedia/assert": "0.2.2",                 "wikimedia/cdb": "1.3.0",                 "wikimedia/composer-merge-plugin": "1.3.0",                 "wikimedia/ip-set": "1.0.1",                 "wikimedia/utfnormal": "1.0.3",                 "wikimedia/wrappedstring": "2.0.0",                 "zordius/lightncandy": "0.21"         } }

{ “name”: “mediawiki/core”, “description”: “Free software wiki application developed by the Wikimedia Foundation and others”, “keywords”: [“mediawiki”, “wiki”], “homepage”: “https://www.mediawiki.org/”, “authors”: [ { “name”: “MediaWiki Community”, “homepage”: “https://www.mediawiki.org/wiki/Special:Version/Credits” } ], “license”: “GPL-2.0+”, “support”: { “issues”: “https://bugs.mediawiki.org/”, “irc”: “irc://irc.freenode.net/mediawiki”, “wiki”: “https://www.mediawiki.org/” }, “require”: { “composer/semver”: “1.0.0”, “cssjanus/cssjanus”: “1.1.1”, “ext-iconv”: “*”, “liuggio/statsd-php-client”: “1.0.16”, “oyejorge/less.php”: “1.7.0.9”, “mediawiki/at-ease”: “1.1.0”, “oojs/oojs-ui”: “0.12.12”, “php”: “>=5.3.3”, “psr/log”: “1.0.0”, “wikimedia/assert”: “0.2.2”, “wikimedia/cdb”: “1.3.0”, “wikimedia/composer-merge-plugin”: “1.3.0”, “wikimedia/ip-set”: “1.0.1”, “wikimedia/utfnormal”: “1.0.3”, “wikimedia/wrappedstring”: “2.0.0”, “zordius/lightncandy”: “0.21” } }

How do I install dependencies defined in composer.json file?

Simply type the following command to download and install all dependencies for your app/project:
$ composer install
OR switch to core project directory such as /var/www/html/wiki and run:
$ cd /var/www/html/wiki && composer install --no-dev
Sample outputs:

Loading composer repositories with package information Installing dependencies from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.   - Removing composer/semver (1.0.0)   - Removing oyejorge/less.php (v1.7.0.9)   - Removing mediawiki/at-ease (v1.1.0)   - Removing wikimedia/avro (v1.7.7)   - Removing nmred/kafka-php (v0.1.4)   - Removing wikimedia/ip-set (1.0.1)   - Removing firebase/php-jwt (v2.1.0)   - Removing symfony/process (v2.7.3)   - Removing ruflin/elastica (2.2.0)   - Removing wikimedia/wrappedstring (v2.0.0)   - Removing monolog/monolog (1.14.0)   - Removing kzykhys/pygments (v1.0.0)   - Removing wikimedia/assert (v0.2.2)   - Removing wikimedia/composer-merge-plugin (v1.3.0)   - Installing wikimedia/composer-merge-plugin (v1.0.0)     Downloading: 100%              - Removing liuggio/statsd-php-client (v1.0.16)   - Installing liuggio/statsd-php-client (v1.0.12)     Downloading: 100%              - Removing oojs/oojs-ui (v0.12.12)   - Installing oojs/oojs-ui (v0.11.3)     Downloading: 100%              - Removing wikimedia/cdb (1.3.0)   - Installing wikimedia/cdb (1.0.1)     Downloading: 100%              - Removing wikimedia/utfnormal (v1.0.3)   - Installing wikimedia/utfnormal (v1.0.2)     Downloading: 100%              - Removing zordius/lightncandy (v0.21)   - Installing zordius/lightncandy (v0.18)     Downloading: 100%              - Installing leafo/lessphp (v0.5.0)     Downloading: 100%            Generating optimized autoload files

Loading composer repositories with package information Installing dependencies from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. – Removing composer/semver (1.0.0) – Removing oyejorge/less.php (v1.7.0.9) – Removing mediawiki/at-ease (v1.1.0) – Removing wikimedia/avro (v1.7.7) – Removing nmred/kafka-php (v0.1.4) – Removing wikimedia/ip-set (1.0.1) – Removing firebase/php-jwt (v2.1.0) – Removing symfony/process (v2.7.3) – Removing ruflin/elastica (2.2.0) – Removing wikimedia/wrappedstring (v2.0.0) – Removing monolog/monolog (1.14.0) – Removing kzykhys/pygments (v1.0.0) – Removing wikimedia/assert (v0.2.2) – Removing wikimedia/composer-merge-plugin (v1.3.0) – Installing wikimedia/composer-merge-plugin (v1.0.0) Downloading: 100%- Removing liuggio/statsd-php-client (v1.0.16) – Installing liuggio/statsd-php-client (v1.0.12) Downloading: 100%- Removing oojs/oojs-ui (v0.12.12) – Installing oojs/oojs-ui (v0.11.3) Downloading: 100%- Removing wikimedia/cdb (1.3.0) – Installing wikimedia/cdb (1.0.1) Downloading: 100%- Removing wikimedia/utfnormal (v1.0.3) – Installing wikimedia/utfnormal (v1.0.2) Downloading: 100%- Removing zordius/lightncandy (v0.21) – Installing zordius/lightncandy (v0.18) Downloading: 100%- Installing leafo/lessphp (v0.5.0) Downloading: 100%Generating optimized autoload files

The above will also create composer.lock file which can be used to update the dependencies later on to the latest version.

How do I update composer.lock file?

If there is no .lock file, this tool will create one based on the dependencies from the .json file. To fetch the dependent libraries to newer versions, run the following command i.e. if you have an existing composer.lock file you will need to run it as follows:
$ composer update
OR switch to core project directory such as /var/www/html/wiki and run:
$ cd /var/www/html/wiki/ && composer update --no-dev
Sample outputs:

> ComposerHookHandler::onPreUpdate Deprecation Notice: The Composer/Package/LinkConstraint/VersionConstraint class is deprecated, use Composer/Semver/Constraint/Constraint instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/VersionConstraint.php:17 Deprecation Notice: The Composer/Package/LinkConstraint/LinkConstraintInterface interface is deprecated, use Composer/Semver/Constraint/ConstraintInterface instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17 Loading composer repositories with package information Updating dependencies     - Removing leafo/lessphp (v0.5.0)   - Removing wikimedia/composer-merge-plugin (v1.0.0)   - Installing wikimedia/composer-merge-plugin (v1.3.0)     Downloading: Connecting...     Downloading: 100%              - Removing liuggio/statsd-php-client (v1.0.12)   - Installing liuggio/statsd-php-client (v1.0.16)     Downloading: Connecting...     Downloading: 100%              - Installing mediawiki/at-ease (v1.1.0)     Downloading: 100%              - Removing oojs/oojs-ui (v0.11.3)   - Installing oojs/oojs-ui (v0.12.12)     Downloading: 100%              - Removing wikimedia/cdb (1.0.1)   - Installing wikimedia/cdb (1.3.0)     Downloading: 100%              - Removing wikimedia/utfnormal (v1.0.2)   - Installing wikimedia/utfnormal (v1.0.3)     Downloading: 100%              - Removing zordius/lightncandy (v0.18)   - Installing zordius/lightncandy (v0.21)     Downloading: 100%              - Installing composer/semver (1.0.0)     Downloading: 100%              - Installing oyejorge/less.php (v1.7.0.9)     Downloading: 100%              - Installing wikimedia/assert (v0.2.2)     Downloading: 100%              - Installing wikimedia/ip-set (1.0.1)     Downloading: 100%              - Installing wikimedia/wrappedstring (v2.0.0)     Downloading: 100%            Writing lock file Generating optimized autoload files

> ComposerHookHandler::onPreUpdate Deprecation Notice: The Composer/Package/LinkConstraint/VersionConstraint class is deprecated, use Composer/Semver/Constraint/Constraint instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/VersionConstraint.php:17 Deprecation Notice: The Composer/Package/LinkConstraint/LinkConstraintInterface interface is deprecated, use Composer/Semver/Constraint/ConstraintInterface instead. in phar:///usr/local/bin/composer/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17 Loading composer repositories with package information Updating dependencies- Removing leafo/lessphp (v0.5.0) – Removing wikimedia/composer-merge-plugin (v1.0.0) – Installing wikimedia/composer-merge-plugin (v1.3.0) Downloading: Connecting… Downloading: 100%- Removing liuggio/statsd-php-client (v1.0.12) – Installing liuggio/statsd-php-client (v1.0.16) Downloading: Connecting… Downloading: 100%- Installing mediawiki/at-ease (v1.1.0) Downloading: 100%- Removing oojs/oojs-ui (v0.11.3) – Installing oojs/oojs-ui (v0.12.12) Downloading: 100%- Removing wikimedia/cdb (1.0.1) – Installing wikimedia/cdb (1.3.0) Downloading: 100%- Removing wikimedia/utfnormal (v1.0.2) – Installing wikimedia/utfnormal (v1.0.3) Downloading: 100%- Removing zordius/lightncandy (v0.18) – Installing zordius/lightncandy (v0.21) Downloading: 100%- Installing composer/semver (1.0.0) Downloading: 100%- Installing oyejorge/less.php (v1.7.0.9) Downloading: 100%- Installing wikimedia/assert (v0.2.2) Downloading: 100%- Installing wikimedia/ip-set (1.0.1) Downloading: 100%- Installing wikimedia/wrappedstring (v2.0.0) Downloading: 100%Writing lock file Generating optimized autoload files

Finally updating mediawiki to version 1.26.0

Now mediawiki will be updated without any problem as composer already fetched required libs for your php app:
$ cd /var/www/html/wiki/
$ php update.php


MediaWiki 1.26.0 UpdaterYour composer.lock file is up to date with current dependencies! Going to run database updates for cbzwikibashportal Depending on the size of your database this may take a while! Abort with control-c in the next five seconds (skip this countdown with –quick) … 0 Turning off Content Handler DB fields for this part of upgrade. …have ipb_id field in ipblocks table. …have ipb_expiry field in ipblocks table. …already have interwiki table …indexes seem up to 20031107 standards. …have rc_type field in recentchanges table. …index new_name_timestamp already set on recentchanges table. …have user_real_name field in user table. …querycache table already exists. …objectcache table already exists. …categorylinks table already exists. …have pagelinks; skipping old links table updates …il_from OK …have rc_ip field in recentchanges table. …index PRIMARY already set on image table. …have rc_id field in recentchanges table. …have rc_patrolled field in recentchanges table. …logging table already exists. …have user_token field in user table. …have wl_notificationtimestamp field in watchlist table. …watchlist talk page rows already present. …user table does not contain user_emailauthenticationtimestamp field. …page table already exists. …have log_params field in logging table. …logging table has correct log_title encoding. …have ar_rev_id field in archive table. …have page_len field in page table. …revision table does not contain inverse_timestamp field. …have rev_text_id field in revision table. …have rev_deleted field in revision table. …have img_width field in image table. …have img_metadata field in image table. …have user_email_token field in user table. …have ar_text_id field in archive table. …page_namespace is already a full int (int(11)). …ar_namespace is already a full int (int(11)). …rc_namespace is already a full int (int(11)). …wl_namespace is already a full int (int(11)). …qc_namespace is already a full int (int(11)). …log_namespace is already a full int (int(11)). …have img_media_type field in image table. …already have pagelinks table. …image table does not contain img_type field. …already have unique user_name index. …user_groups table exists and is in current format. …have ss_total_pages field in site_stats table. …user_newtalk table already exists. …transcache table already exists. …have iw_trans field in interwiki table. …wl_notificationtimestamp is already nullable. …index times already set on logging table. …have ipb_range_start field in ipblocks table. …no page_random rows needed to be set …have user_registration field in user table. …templatelinks table already exists …externallinks table already exists. …job table already exists. …have ss_images field in site_stats table. …langlinks table already exists. …querycache_info table already exists. …filearchive table already exists. …have ipb_anon_only field in ipblocks table. …index rc_ns_usertext already set on recentchanges table. …index rc_user_text already set on recentchanges table. …have user_newpass_time field in user table. …redirect table already exists. …querycachetwo table already exists. …have ipb_enable_autoblock field in ipblocks table. …index pl_namespace on table pagelinks includes field pl_from. …index tl_namespace on table templatelinks includes field tl_from. …index il_to on table imagelinks includes field il_from. …have rc_old_len field in recentchanges table. …have user_editcount field in user table. …page_restrictions table already exists. …have log_id field in logging table. …have rev_parent_id field in revision table. …have pr_id field in page_restrictions table. …have rev_len field in revision table. …have rc_deleted field in recentchanges table. …have log_deleted field in logging table. …have ar_deleted field in archive table. …have ipb_deleted field in ipblocks table. …have fa_deleted field in filearchive table. …have ar_len field in archive table. …have ipb_block_email field in ipblocks table. …index cl_sortkey on table categorylinks includes field cl_from. …have oi_metadata field in oldimage table. …index usertext_timestamp already set on archive table. …index img_usertext_timestamp already set on image table. …index oi_usertext_timestamp already set on oldimage table. …have ar_page_id field in archive table. …have img_sha1 field in image table. …protected_titles table already exists. …have ipb_by_text field in ipblocks table. …page_props table already exists. …updatelog table already exists. …category table already exists. …category table already populated. …have ar_parent_id field in archive table. …have user_last_timestamp field in user_newtalk table. …protected_titles table has correct pt_title encoding. …have ss_active_users field in site_stats table. …ss_active_users user count set… …have ipb_allow_usertalk field in ipblocks table. …pl_namespace, tl_namespace, il_to indices are already UNIQUE. …change_tag table already exists. …tag_summary table already exists. …valid_tag table already exists. …user_properties table already exists. …log_search table already exists. …have log_user_text field in logging table. …l10n_cache table already exists. …index ls_field_val already set on log_search table. …index change_tag_rc_tag already set on change_tag table. …have rd_interwiki field in redirect table. …transcache tc_time already converted. …*_mime_minor fields are already long enough. …iwlinks table already exists. …index iwl_prefix_title_from already set on iwlinks table. …have ul_value field in updatelog table. …have iw_api field in interwiki table. …iwl_prefix key doesn’t exist. …have cl_collation field in categorylinks table. …categorylinks up-to-date. …collations up-to-date. …msg_resource table already exists. …module_deps table already exists. …ar_page_revid key doesn’t exist. …index ar_revid already set on archive table. …ll_lang is up-to-date. …user_last_timestamp is already nullable. …index user_email already set on user table. …up_property in table user_properties already modified by patch patch-up_property.sql. …uploadstash table already exists. …user_former_groups table already exists. …index type_action already set on logging table. …have rev_sha1 field in revision table. …batch conversion of user_options: nothing to migrate. done. …user table does not contain user_options field. …have ar_sha1 field in archive table. …index page_redirect_namespace_len already set on page table. …have us_chunk_inx field in uploadstash table. …have job_timestamp field in job table. …index page_user_timestamp already set on revision table. …have ipb_parent_block_id field in ipblocks table. …index ipb_parent_block_id already set on ipblocks table. …category table does not contain cat_hidden field. …have rev_content_format field in revision table. …have rev_content_model field in revision table. …have ar_content_format field in archive table. …have ar_content_model field in archive table. …have page_content_model field in page table. Content Handler DB fields should be usable now. …site_stats table does not contain ss_admins field. …recentchanges table does not contain rc_moved_to_title field. …sites table already exists. …have fa_sha1 field in filearchive table. …have job_token field in job table. …have job_attempts field in job table. …have us_props field in uploadstash table. …ug_group in table user_groups already modified by patch patch-ug_group-length-increase-255.sql. …ufg_group in table user_former_groups already modified by patch patch-ufg_group-length-increase-255.sql. …index pp_propname_page already set on page_props table. …index img_media_mime already set on image table. …iwl_prefix_title_from index is already non-UNIQUE. …index iwl_prefix_from_title already set on iwlinks table. …have ar_id field in archive table. …have el_id field in externallinks table. …have rc_source field in recentchanges table. …index log_user_text_type_time already set on logging table. …index log_user_text_time already set on logging table. …have page_links_updated field in page table. …have user_password_expires field in user table. …have pp_sortkey field in page_props table. …recentchanges table does not contain rc_cur_time field. …index wl_user_notificationtimestamp already set on watchlist table. …have page_lang field in page table. …have pl_from_namespace field in pagelinks table. …have tl_from_namespace field in templatelinks table. …have il_from_namespace field in imagelinks table. …img_major_mime in table image already modified by patch patch-img_major_mime-chemical.sql. …oi_major_mime in table oldimage already modified by patch patch-oi_major_mime-chemical.sql. …fa_major_mime in table filearchive already modified by patch patch-fa_major_mime-chemical.sql. …user_id is already unsigned int. …rc_comment in table recentchanges already modified by patch patch-editsummary-length.sql. Dropping table hitcounter …done. Table site_stats contains ss_total_views field. Dropping …done. Table page contains page_counter field. Dropping …done. …site_stats is populated…done. …Update ‘populate rev_len and ar_len’ already logged as completed. …Update ‘populate rev_sha1’ already logged as completed. …img_sha1 column of image table already populated. …protocol-relative URLs in externallinks table already fixed. …fa_sha1 column of filearchive table already populated. …*_from_namespace column of backlink tables already populated. Set the local repo temp zone container to be private. Purging caches…done.Done in 0.4 s.

Command summary

This tutorial described how to install the composer and update mediawiki. But, if you just need the composer tool for your own project, just run the following commands:
$ sudo apt-get install curl php5-cli git
$ sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
$ composer

Now create your own .json file:
$ cd /my/cool/project/
$ vi composer.json

Install the dependencies for your project from composer.json, enter:
$ composer install
To update the dependencies for your project:
$ composer update
And, there you have it composer installed and working for your LAMP project.

root

Leave a Reply

Your email address will not be published. Required fields are marked *