I am using Ubuntu 16.04 wanted to install LAMP Stack via below commands,
sudo apt-get autoremove --purge php5-*
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.1 php7.1-cli php7.1-common php7.1-dev
sudo apt-get -y install libapache2-mod-php7.1
sudo apt-get -y install php7.1-pgsql php7.1-mysql
sudo apt-get -y install php7.1-fpm php7.1-bz2 php7.1-json php7.1-phpdbg php7.1-intl php7.1-gd php7.1-curl php7.1-mbstring php7.1-mcrypt php7.1-xdebug php7.1-xml php7.1-zip
sudo apt-get -y install php-pear php-imagick php7.1-imap php-memcache php7.1-pspell php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xmlrpc php7.1-xsl php-gettext
Apache2 and php is working More on running php composer.phar install
got below errors
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
Cannot load Zend OPcache - it was already loaded
PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
PHP Warning: Module 'bz2' already loaded in Unknown on line 0
PHP Warning: Module 'calendar' already loaded in Unknown on line 0
PHP Warning: Module 'ctype' already loaded in Unknown on line 0
PHP Warning: Module 'curl' already loaded in Unknown on line 0
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'exif' already loaded in Unknown on line 0
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning: Module 'ftp' already loaded in Unknown on line 0
PHP Warning: Module 'gd' already loaded in Unknown on line 0
PHP Warning: Module 'gettext' already loaded in Unknown on line 0
PHP Warning: Module 'iconv' already loaded in Unknown on line 0
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
PHP Warning: Module 'imap' already loaded in Unknown on line 0
PHP Warning: Module 'intl' already loaded in Unknown on line 0
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0
PHP Warning: Module 'pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'Phar' already loaded in Unknown on line 0
PHP Warning: Module 'posix' already loaded in Unknown on line 0
PHP Warning: Module 'pspell' already loaded in Unknown on line 0
PHP Warning: Module 'readline' already loaded in Unknown on line 0
PHP Warning: Module 'recode' already loaded in Unknown on line 0
PHP Warning: Module 'shmop' already loaded in Unknown on line 0
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning: Module 'sockets' already loaded in Unknown on line 0
PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0
PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning: Module 'tidy' already loaded in Unknown on line 0
PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning: Module 'wddx' already loaded in Unknown on line 0
PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning: Module 'xmlrpc' already loaded in Unknown on line 0
PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning: Module 'xsl' already loaded in Unknown on line 0
PHP Warning: Module 'zip' already loaded in Unknown on line 0
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Cannot load Zend OPcache - it was already loaded
PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
PHP Warning: Module 'bz2' already loaded in Unknown on line 0
PHP Warning: Module 'calendar' already loaded in Unknown on line 0
PHP Warning: Module 'ctype' already loaded in Unknown on line 0
PHP Warning: Module 'curl' already loaded in Unknown on line 0
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'exif' already loaded in Unknown on line 0
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning: Module 'ftp' already loaded in Unknown on line 0
PHP Warning: Module 'gd' already loaded in Unknown on line 0
PHP Warning: Module 'gettext' already loaded in Unknown on line 0
PHP Warning: Module 'iconv' already loaded in Unknown on line 0
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
PHP Warning: Module 'imap' already loaded in Unknown on line 0
PHP Warning: Module 'intl' already loaded in Unknown on line 0
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0
PHP Warning: Module 'pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'Phar' already loaded in Unknown on line 0
PHP Warning: Module 'posix' already loaded in Unknown on line 0
PHP Warning: Module 'pspell' already loaded in Unknown on line 0
PHP Warning: Module 'readline' already loaded in Unknown on line 0
PHP Warning: Module 'recode' already loaded in Unknown on line 0
PHP Warning: Module 'shmop' already loaded in Unknown on line 0
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning: Module 'sockets' already loaded in Unknown on line 0
PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0
PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning: Module 'tidy' already loaded in Unknown on line 0
PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning: Module 'wddx' already loaded in Unknown on line 0
PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning: Module 'xmlrpc' already loaded in Unknown on line 0
PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning: Module 'xsl' already loaded in Unknown on line 0
PHP Warning: Module 'zip' already loaded in Unknown on line 0
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to parse file "/var/www/html/symfony2-demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml".
[InvalidArgumentException]
The XML file "/var/www/html/symfony2-demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml" is not valid.
[Symfony\Component\Debug\Exception\ContextErrorException]
Notice: Undefined property: DOMDocument::$documentElement
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
Cannot load Zend OPcache - it was already loaded
PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
PHP Warning: Module 'bz2' already loaded in Unknown on line 0
PHP Warning: Module 'calendar' already loaded in Unknown on line 0
PHP Warning: Module 'ctype' already loaded in Unknown on line 0
PHP Warning: Module 'curl' already loaded in Unknown on line 0
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'exif' already loaded in Unknown on line 0
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning: Module 'ftp' already loaded in Unknown on line 0
PHP Warning: Module 'gd' already loaded in Unknown on line 0
PHP Warning: Module 'gettext' already loaded in Unknown on line 0
PHP Warning: Module 'iconv' already loaded in Unknown on line 0
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
PHP Warning: Module 'imap' already loaded in Unknown on line 0
PHP Warning: Module 'intl' already loaded in Unknown on line 0
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0
PHP Warning: Module 'pgsql' already loaded in Unknown on line 0
PHP Warning: Module 'Phar' already loaded in Unknown on line 0
PHP Warning: Module 'posix' already loaded in Unknown on line 0
PHP Warning: Module 'pspell' already loaded in Unknown on line 0
PHP Warning: Module 'readline' already loaded in Unknown on line 0
PHP Warning: Module 'recode' already loaded in Unknown on line 0
PHP Warning: Module 'shmop' already loaded in Unknown on line 0
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning: Module 'sockets' already loaded in Unknown on line 0
PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0
PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning: Module 'tidy' already loaded in Unknown on line 0
PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning: Module 'wddx' already loaded in Unknown on line 0
PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning: Module 'xmlrpc' already loaded in Unknown on line 0
PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning: Module 'xsl' already loaded in Unknown on line 0
PHP Warning: Module 'zip' already loaded in Unknown on line 0
[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
Unable to parse file "/var/www/html/symfony2-demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml".
[InvalidArgumentException]
The XML file "/var/www/html/symfony2-demo/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml" is not valid.
[Symfony\Component\Debug\Exception\ContextErrorException]
Notice: Undefined property: DOMDocument::$documentElement
It seems this problem connected with this feature of composer https://github.com/composer/windows-setup/issues/58
You may disable xdebug to make things works.