21

Anyone installed laravel 5 on Ubuntu 16.04? I've just switched to Ubuntu 16.04 and I'm trying to install laravel 5 framework on it using composer. But every time I try to create a project it gives me this erros

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/laravel v5.2.0 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.15 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.23 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.24 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.27 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.29 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/laravel v5.2.31 requires laravel/framework 5.2.* -> satisfiable by laravel/framework[v5.2.0, v5.2.1, v5.2.10, v5.2.11, v5.2.12, v5.2.13, v5.2.14, v5.2.15, v5.2.16, v5.2.17, v5.2.18, v5.2.19, v5.2.2, v5.2.20, v5.2.21, v5.2.22, v5.2.23, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.29, v5.2.3, v5.2.30, v5.2.31, v5.2.4, v5.2.5, v5.2.6, v5.2.7, v5.2.8, v5.2.9].
    - laravel/framework v5.2.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.31 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.30 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.29 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.26 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.25 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.24 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.23 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.22 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.21 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.20 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.19 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.18 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.16 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - laravel/framework v5.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for laravel/laravel ^5.2 -> satisfiable by laravel/laravel[v5.2.0, v5.2.15, v5.2.23, v5.2.24, v5.2.27, v5.2.29, v5.2.31].

  To enable extensions, verify that they are enabled in those .ini files:
    - /etc/php/5.6/cli/php.ini
    - /etc/php/5.6/cli/conf.d/10-opcache.ini
    - /etc/php/5.6/cli/conf.d/10-pdo.ini
    - /etc/php/5.6/cli/conf.d/20-calendar.ini
    - /etc/php/5.6/cli/conf.d/20-ctype.ini
    - /etc/php/5.6/cli/conf.d/20-exif.ini
    - /etc/php/5.6/cli/conf.d/20-fileinfo.ini
    - /etc/php/5.6/cli/conf.d/20-ftp.ini
    - /etc/php/5.6/cli/conf.d/20-gettext.ini
    - /etc/php/5.6/cli/conf.d/20-iconv.ini
    - /etc/php/5.6/cli/conf.d/20-json.ini
    - /etc/php/5.6/cli/conf.d/20-phar.ini
    - /etc/php/5.6/cli/conf.d/20-posix.ini
    - /etc/php/5.6/cli/conf.d/20-readline.ini
    - /etc/php/5.6/cli/conf.d/20-shmop.ini
    - /etc/php/5.6/cli/conf.d/20-sockets.ini
    - /etc/php/5.6/cli/conf.d/20-sysvmsg.ini
    - /etc/php/5.6/cli/conf.d/20-sysvsem.ini
    - /etc/php/5.6/cli/conf.d/20-sysvshm.ini
    - /etc/php/5.6/cli/conf.d/20-tokenizer.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, deleting ./composer.json.

I read articles Here one of them say that Ubuntu 16.04 comes with PHP7 as default but we can still use PHP5. However I tried both PHP7 & PHP5 and still get the same errors! Any ideas? Thanks

30

How to install Laravel in Ubuntu 16.04

Update: Laravel 5.4

Because of great interest for this question I have decided to update it and create a small bash script to install everything you need to work with Laravel (this one is with the NGINX)

https://github.com/emilas44/laravel-5.4-on-Ubuntu/blob/master/script.sh

You can simply copy it and edit it as you please...maybe you already have some components installed which are inside the script, if so, you can freely delete the parts which you don't need.


Laravel 5.2 is down below:

basic stuff install (optional)

sudo apt-get install git
sudo apt-get install zip

LAMP

sudo apt-get install tasksel
sudo tasksel install lamp-server

CURL

sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext

enable mods

sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo a2enmod rewrite
sudo systemctl restart apache2

Composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

install phpmyadmin

sudo apt-get install phpmyadmin     

later accessible through localhost/phpmyadmin

Creating Laravel Project

cd /var/www/html/
sudo composer create-project laravel/laravel work --prefer-dist
sudo chmod -R 777 work (do not set 777 on "live" server!)

Creating Virtual Host work.com

sudo gedit /etc/apache2/sites-available/work.com.conf

and paste this inside that document


#/etc/apache2/sites-available/work.com.conf contains following lines
<VirtualHost *:80>
        ServerName work.com
        DocumentRoot /var/www/html/work/public

        <Directory /var/www/html/work/public>
            AllowOverride All
            Require all granted
        </Directory>
</VirtualHost>

enable that site

sudo a2ensite work.com
service apache2 reload

fix hosts file so you can access it through web browser

sudo gedit /etc/hosts //space between gedit and destination!

        #/etc/hosts contents following lines                                
        127.0.0.1       work.com

or use this command

sudo -- sh -c "echo '\n127.0.0.1 \twork.com'>> /etc/hosts"

That's it laravel is installed!

I have made a tutorial on youtube how to make it right....With all the things you need to work with laravel. Here is the link: https://www.youtube.com/watch?v=A6TdaRIsG6g

  • If for example I did not want to run composer as sudo, what could I do? there is a warning saying dont use sudo with composer. – m33bo Dec 24 '16 at 11:35
  • you need to make directory as user and install laravel and composer without using sudo – lewis4u Dec 24 '16 at 12:44
  • sweet. 100+ Works on my machine – Semo Jan 18 '17 at 11:51
  • Excuse me, isn't chmod 775 enough? – Semo Jan 18 '17 at 12:55
  • 1
    storage and bootstrap folder need to have 777 – lewis4u May 22 '18 at 13:30
3

I had upgraded php 5.6.11 to 5.6.21.

So, in my case I had to run:

sudo apt-get install php5.6-mbstring

PS: How I upgraded from 5.6.11 to 5.6.21 following:

sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php 
sudo apt-get update 
sudo apt-get install php5.6

Reason for upgrade: zend_mm_heap corrupted during composer update.

3

These are the steps I had to take to install Laravel 5 on Ubuntu Server 16.04 after a fresh upgrade

First I had to completely remove all of PHP, so as Mohammad Barhoush stated:

  • sudo apt-get -y purge php.*

Then I reinstalled PHP with:

  • sudo apt install php libapache2-mod-php
  • sudo apt install php-cli
  • sudo apt install php-mysql

After reinstalling PHP ver.7.0 I installed the additional related packages that Mohhammad recommended:

  • sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext php-gd

And enabled the mods

  • sudo phpenmod mcrypt
  • sudo phpenmod mbstring

    And finally after all this composer was still being a pain complaining it did not have the zip extension for a composer update so I installed the following:

  • sudo apt-get install php7.0-zip

After that it ran just fine with no errors!

These were the steps required for me to get laravel 5 functioning coming from the previous LTS version of Ubuntu Server. Hope this helped! Best regards :)

-Derick

2

PHP mbstring extension now resides in a separate package, so you need to do:

apt-get install php-mbstring
1

oerdnj 's solution works, after installing mbstring you should enable it in php.ini before run composer install. In my case laravel requires ext-mbstring and ext-dom:
apt-get install php-dom

  • but he's not telling how to add it to php.ini :( – Juliatzin del Toro May 4 '16 at 20:05
1

Thank you all for your responses.. I'm finally able to solve this issue by doing:

  • Completely remove php first:

    sudo apt-get -y purge php.*

  • Reinstall php and these important related packages:

    sudo apt-get install curl php-curl php-mcrypt php-mbstring php-gettext

  • Enable mods (Thanks to lewis4u video):

    sudo phpenmod mcrypt

    sudo phpenmod mbstring

1

There you need to do something manually in the configuration file .. I found out this article was really helpful. First, need to check weather mbstring.dll library is already installed in the system using 'phpinfo()' function . If its enabled , instead of uncommenting 'extension=php_mbstring.dll' just keep it commented in php.ini config file or if its not there install it by sudo apt-get install php-mbstring php7.0-mbstring

Then just configure the following .

; mbstring.language = All
;mbstring.internal_encoding = UTF-8
;mbstring.http_output = UTF-8
;mbstring.encoding_translation = On
;mbstring.func_overload = 0

That's it.. I think you know the rest of the things like how to install laravel and all..

1

So I had the same problem as the above guy where I needed to install php-dom so i tried to run apt-get install php-dom but the it just came up with the message

Package php-dom is a virtual package provided by:
php5.5-xml 5.5.35-1+donate.sury.org~xenial+2
php7.0-xml 7.0.6-1+donate.sury.org~xenial+1
php5.6-xml 5.6.21-1+donate.sury.org~xenial+2
You should explicitly select one to install.

As im a bit new to terminal I found this a bit confusing but I am running Ubuntu 16.04 with php7 so I just ran: apt-get install php7.0-xml and that worked for me...hope that helps someone!

0

To install Laravel 5.4 on Ubuntu 16.04 as in Laravel documentation with check:

  1. Check your PHP version in terminal by : php -v , your php version must be PHP >= 5.6.4
  2. Check in terminal with php -m for OpenSSL PHP Extension and PDO PHP Extension .
  3. Terminal: sudo apt install php-mbstring and check again by php -m for Mbstring PHP Extension and Tokenizer PHP Extension.

  4. Terminal: sudo apt install php-xml and check again by php -m for XML PHP Extension

  5. Download Composer by these 4 steps in terminal :

    • php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

    • php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

    • php composer-setup.php

    • php -r "unlink('composer-setup.php');"

  6. Check composer in terminal: php composer.phar

  7. Install Laravel in terminal:

    php composer.phar global require "laravel/installer"
    The output in terminal will show your current directory to /home/yourname/.config/composer , go to your current directory and press ctrl+h to show hidden file.
    Go to .config folder then composer folder with the following contents: composer folder contents

  8. Create Laravel project in /var/www/html in terminal:

    php composer.phar create-project --prefer-dist laravel/laravel /var/www/html/myLaravel

  9. Open your myLaravel in terminal then paste : php artisan serve and copy http://127.0.0.1:8000 in your browser

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.