Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install PHP Framework Laravel on CentOS 7 / Ubuntu 15.04

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the CentOS 7 / Ubuntu 15.04 on how to install PHP framework Laravel related knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone after reading this CentOS 7 / Ubuntu 15.04 on how to install PHP framework Laravel article will have a harvest, let's take a look at it.

Laravel is an open source PHP framework that is powerful and easy to understand. It follows the model-view-controller design pattern (MVC). Laravel reuses existing components of different frameworks, which helps to create Web applications. The Web application designed in this way is more structured and practical.

1) Server requirements

Before installing Laravel, you need to install some of its dependency prerequisites, mainly some basic parameter adjustments, such as upgrading the system to the latest version, sudo permissions, and installing dependency packages.

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

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 updateUbuntu# apt-get install python-software-properties# add-apt-repository ppa:ondrej/php5# apt-get update# apt-get install-yp hp5 mcrypt php5-mcrypt php5-gd2) Firewall installation

System firewall and SELinux settings are very important for product application security. When you use the test server, you can turn off the firewall and set SELinux into tolerant mode permissive with the following command line to ensure that the installer is not affected by them.

# setenforce 03) Apache, MariaDB, PHP installation

The Laravel installer needs to complete the installation of the entire LAMP environment and requires additional installation of 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 plug-ins 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 enable MySQL / Mariadb services to 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 starting the MariaDB service, you need to run the following command to configure a sufficiently secure password.

# mysql_secure_installationUbuntu# apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql4) 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 various dependencies of Laravel.

CentOS/Ubuntu

Run the following command under CentOS / Ubuntu to configure 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 extract the installation package and move the root directory of document.

# unzip develop.zip# mv laravel-develop / var/www/

Now use the compose command to install all the dependencies required by Laravel in the directory.

# cd / var/www/laravel-develop/# composer install

6) key

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 the key in the 'app.php' file, as shown below.

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

7) Virtual hosts and users

After composer is installed, assign permissions and users to the document root directory, 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 the apache server with any editor and add the virtual host configuration at the end of the file.

# vim / etc/httpd/conf/httpd.confServerName laravel-developDocumentRoot / var/www/laravel/public AllowOverride All

Now let's restart the apache server with the following command and open a browser to view the localhost page.

CentOS# systemctl restart httpdUbuntu# service apache2 restart8) Laravel 5 Network access

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

This is the end of the article on "how to install PHP Framework Laravel on CentOS 7 / Ubuntu 15.04". Thank you for reading! I believe you all have some knowledge about "how to install PHP Framework Laravel on CentOS 7 / Ubuntu 15.04". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report