How to install the PHP framework on CentOS 7/ubuntu 15.04 Laravel

Source: Internet
Author: User
Tags mcrypt php framework composer install how to install laravel fully qualified domain name
Hello everyone, this article will tell you how to install Laravel on CentOS 7/ubuntu 15.04. If you are a PHP Web developer, you do not need to consider how to choose in a variety of modern PHP framework, Laravel is the most easy to start and run, it saves time and effort, can let you enjoy the fun of Web development. Laravel believes in a universal philosophy of development, creating maintainable code with simple guidance is the top priority, and you will maintain a high speed of development efficiency and be able to improve existing functionality without fear of changing your code at any time.

Laravel installation is not cumbersome, just follow this article to install on the CentOS 7 or Ubuntu 15 server.

1) Server Requirements

Before installing Laravel, it is necessary to install some of its dependencies, mainly some basic parameter adjustments, such as upgrading the system to the latest version, sudo permissions, and installing dependent packages.

When you connect to your server, make sure you can successfully use the EPEL repository and upgrade your server with the following commands.

CentOS-7

# yum Install epel-release# RPM-UVH https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm# RPM-UVH https://mirror.webtatic.com/yum/el7/webtatic-release.rpm# Yum Update

Ubuntu

# apt-get Install python-software-properties# add-apt-repository ppa:ondrej/php5# apt-get update# apt-get install-y php5 MCrypt Php5-mcrypt PHP5-GD

2) Firewall installation

The system firewall and SELinux settings are important for product application security, and when you use a test server you can turn off the firewall and set the SELinux into tolerant mode (permissive) under the command line to ensure that the installer is not affected by them.

# Setenforce 0

3) Apache, MariaDB, PHP installation

The Laravel installer needs to complete the installation LAMP environment and requires additional PHP extensions such as OpenSSL, Pdo,mbstring and Tokenizer. If LAMP is already running on your server you can skip this step and directly confirm that some of the necessary PHP plugins are installed.

To install the full AMP you need to run the following command on your own server.

Centos

# yum Install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring

To implement the MYSQL/MARIADB service boot automatically on CentOS 7, you need to run the following command.

# Systemctl start httpd# systemctl enable Httpd#systemctl start Mysqld#systemctl enable mysqld

After you start the MariaDB service, you need to run the following command to configure a password that is secure enough.

#mysql_secure_installation

Ubuntu

# apt-get Install mysql-server apache2 libapache2-mod-php5 php5-mysql

4) Install Composer

Before we install Laravel, let's start installing composer. Installing composer is one of the most important steps in installing Laravel because composer can help us install the various dependencies of Laravel.

Centos/ubuntu

Run the following command under Centos/ubuntu to configure the composer.

# CURL-SS Https://getcomposer.org/installer | php# MV composer.phar/usr/local/bin/composer# chmod +x/usr/local/bin/composer

5) Install Laravel

We can run the following command to download the Laravel installation package from GitHub.

# wget Https://github.com/laravel/laravel/archive/develop.zip

Run the following command to unzip the installation package and move the document's root directory.

# Unzip develop.zip# MV laravel-develop/var/www/

Now use the Compose command to install the dependencies required for all Laravel in the directory.

# cd/var/www/laravel-develop/# Composer Install

6) Key

In order to encrypt the server, we use the following command to generate an encrypted 32-bit key.

# PHP Artisan key:generateapplication key [Lf54qk56s3qdh0ywgf9jdrxo2n0ov9qi] set successfully

Now put this key in the ' app.php ' file, as shown below.

# vim/var/www/laravel-develop/config/app.php

7) Virtual hosting and the owning user

After the composer is installed, assign the permissions of the document root directory and the owning user as shown below.

# chmod 775/var/www/laravel-develop/app/storage# chown-r Apache:apache/var/www/laravel-develop

Open the default configuration file for Apache server with any editor and add the virtual host configuration at the end of the file.

# vim/etc/httpd/conf/httpd.conf
ServerName Laravel-developdocumentroot/var/www/laravel/publicstart Directory/var/www/laravelallowoverride Alldirectory Close

Now we restart the Apache server with the following command, open the browser to view the localhost page.

Centos

# systemctl Restart httpd

Ubuntu

# Service Apache2 Restart

8) Laravel 5 Network access

Open the browser and enter your configured IP address or full domain name (Fully qualified domain name) and you will see the default page for Laravel 5.

Summarize

The Laravel framework is a great tool for developing Web applications. So, after reading this article you will learn to install Laravel on Ubuntu 15 and CentOS 7, and then you can use the various features and comfort and convenience provided by this awesome PHP framework to carry out your development work.

If you have any comments or suggestions please reply in the comments section below, we will be based on your valuable feedback to make our article more easy to understand.

via:http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/

Author: kashif Translator: Neartan proofreading: Caroline

This article was compiled by LCTT original, Linux China honors launched

  • 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.