Comments on Installing Laravel PHP Framework on Ubuntu 16.04 for Apache

Laravel is a very popular open source PHP framework aimed at easy development of applications. If you are looking for a new PHP framework to try, you should give Laravel a try. The following guide will allow you to run Laravel on an Ubuntu 16.04 based Apache server.

48 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Danny

You got me with this:

sudo composer create-project laravel/laravel your-project --prefer-dist

So after we have to do:

sudo chgrp -R www-data /var/www/html/your-projectsudo chmod -R 775 /var/www/html/your-project/storage

(where is your-project is some project name)

Also here:

<VirtualHost *:80>    ServerName localhost    ServerAdmin webmaster@localhost    DocumentRoot /var/www/html/your-project/public    <Directory /var/www/html/your-project>        AllowOverride All    </Directory>    ErrorLog ${APACHE_LOG_DIR}/error.log    CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>Because project will never start...But any way, thank you guys for great tutorial ;)

By: Áquila Freitas

Best tutorial so far. Congrats!

By: jinngala

very useful. Thanks.

By: Pytho*

 Best explanation I've ever encountered! Thnx,

By: ahmed

thanks , very simple and useful.

By: kamboj

perfect!!! everything has been in order !!! thanks

i've been trying to install for last 2 days. 

By: Dakota

This is the only tutorial I've been able to use to install laravel succcessfully. Thanks a lot!

By: vishnu

Very usefull...Thanks

By: Andrew Pearson

Your configure apache section worked perfectly to solve my problem.

By: Nkeng Newton

Everything worked like cham!!. Great post and Thanks

By: Sooraj Kv

Awesome tutorial

By: anna

after running

sudo apt-get install apache2 libapache2-mod-php5

this shows up:

The following packages have unmet dependencies:

libapache2-mod-php5: Depends: apache2-api-20120211 but it is not installable

Depends: apache2(>= 2.4)

E: Unable to correct problems, you have held broken packages.

I really dont know how to move forward from this

By: till

run:

 

apt-get update

 

and then try the failed command again.

By: Nuno Coelho

 hi people,

after i follow this tutorial, in the end give me on error

 * Restarting web server apache2                                         [fail]  * The apache2 configtest failed.Output of config test was:AH00526: Syntax error on line 2 of /etc/apache2/sites-enabled/laravel.conf:Invalid command '\xc2\xa0\xc2\xa0', perhaps misspelled or defined by a module not included in the server configurationAction 'configtest' failed.

i do this

sudo chgrp -R www-data /var/www/html/extremesudo chmod -R 775 /var/www/html/extreme/storage

 

this is i have in laravel.conf

<VirtualHost *:80>     ServerName localhost     ServerAdmin webmaster@localhost     DocumentRoot /var/www/html/extreme/public     <Directory /var/www/html/extreme>         AllowOverride All     </Directory>     ErrorLog ${APACHE_LOG_DIR}/error.log     CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>

 

 

what i do wrong?

By: MaxDp

Really clear and detailed instructions.Can't thank you enough ! :D

By: Bill

Followed all instructions but hit one problem at the end. /localhost/index creates a Laravel routes error but /localhost/index.php runs fine.

I'm running Ubuntu 16.04 LTS and php7. Laravel version is 5.3.9.

The biggest problems with Laravel are the subtle changes from release to release which means each release requires a different installation stragety. :/

By: Federico

Best tutorial. It works like a charm!

By: Vincent

Hi! I have tried to install the laravel..but when I type this command "sudo composer create-project laravel/laravel your-project --prefer-dist" I get the following error:  [Composer\Downloader\TransportException]                                       The "https://packagist.org/packages.json" file could not be downloaded: fai    led to open stream: Connection timed out    ......Somebody help...I will so much appreciate thanks

By: dharsan

How to install laravel 5.3 on ubuntu ?

By: Ahmed Aatef

Thank you!

By: BluePen Labs

Versions of php and Apache are no more supported in Ubuntu.

Solution : 

sudo apt install apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-intl php-pear php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-recode php7.0-sqlite3 php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-mbstring php-gettext

By: mayank

 I got all the things done accordding to this tutorial and without any error but going to localhost, it shows completely blank screen. so, i don't know whether laravel is working fine or not.

I  am new to laravel. Can anyone suggest me what to do?

Any help will be highly apprecciated.

By: Raj

How can I run two websites (main domain website mainwebsite.com in HTML, mainwebsite.com/laravel-project ). How can I make sure that both websites are running after disabling default config? How to take care of that?

Thanks in advance!

By: Bishwarup

Step: 'composer install' is missing

By: Bachi

Thank you. Worked like a charm

By: Apadana

sudo add-apt-respository ppa:ondrej/php5  ---> sudo add-apt-repository ppa:ondrej/php5

By: ali

after run :

                  sudo composer create-project laravel/laravel your-project --prefer-dist

 

i got "Do not run Composer as root/super user! See https://getcomposer.org/root for details"

what could go wrong ?

 

 

By: Vikas Sharma

sudo add-apt-repository ppa:ondrej/php5'This PPA does not support trusty'Cannot add PPA: ''This PPA does not support trusty''.

Please help me..

 

By: Ludhiana

how to restart server after closing system and using that again.

By: Dmitriy

Thanks! This works great! :)

By: Alfredo

Thanks, this tutorial really works.

By: Dindin Wahidin

Best tutorial... Congrats. I've been searching for tutorial on website and I always get orror on instalation. And now I found your website. Ta da.. everything gonna be allright

 

By: Marcos Martins

Great!I change one thing:

chgrp -R www-data /var/www/html/project

for:chown -R www-data:www-data /var/www/html/projectGive all permissions to web service

By: Ankit

Thanks a lot bhai.. 

By: Dmitriy

Thank you, man!

By: kossi

Thanks.

By: George Sruthin

sudo add-apt-respository ppa:ondrej/php5 please replce this command line because you have misspelled repository

By: NetLicensing

Nice article, thank you!

An easy way to try out Laravel in action is to use Laravel 5 Boilerplate / Starter Kit - https://github.com/Labs64/laravel-boilerplate

This is also offering Docker container, with this you don’t need a local PHP (composer, node.js, etc.) environment and can start to evaluate Laravel right away.

By: wayne

the best tutorial for laravel installation , please update with php7 version too.

 

Thanks

By: Cleomir

I only needed the apache configuration and it worked perfectly on Debian Stretch, thanks a lot!

By: Mahendra Gurjar

Good !

I am successfully instald laravel for thanks.

By: cyka

Running sudo chgrp -R www-data /var/www/html/project command just messed up my entire linux, now my sudo command doesn't work.

By: till

The command is fine, it can not mess up your Linux when typed in correctly. Most likely, you added a whitespace somewhere in the path.

By: Alex

Why on earth you give ownership to the whole filesystem of your web project to apache user? you don't really need it and it opens the project to any kind of defacement if you have a small bug or any uncontrolled upload feature in your application

By: Kaatje

How do I know what IP my server is on? Tried localhost, but that only gives my apache install info.

By: ncik

I follow the step but it didn`t work what goes wrong 

<VirtualHost *:80>

    ServerName mylaravel.test

 

    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html/mylaravel/public

 

    <Directory /var/www/html/mylaravel>

        AllowOverride All

    </Directory>

 

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

this is my laravel.conf 

someone help me thanks

By: Octavio

Nice... this is my favorite tutorial

By: Dmaster

Great tutorial Very useful