Follow me to learn Laravel installation laravel_php instance

Source: Internet
Author: User
Tags time zones php json composer install nginx server

Install composer

The Laravel framework manages code dependencies using Composer (PHP package management tool, reference Composer Chinese document). First, you need to download the composer Phar Packaging file (composer.phar), download it in the project directory, or place it in the Usr/local/bin directory for global invocation in the system. In the Windows operating system, you can use the composer Windows installation tool.

Install Laravel

Install via Laravel Installer

Download the Laravel installer PHAR file first. For convenience, rename the file to Laravel and move to the/usr/local/bin directory. When you're done, simply enter the simple laravel new command in the directory you specify to create a new Laravel installation. For example, the Laravel new blog will create a directory called Blogs that contains a new Laravel installation and the required dependencies. This installation method is much faster than the installation via Composer.

Install laravel via Composer create-project command

You can also install Laravel by executing the Composer create-project command at the command line:

Copy Code code as follows:

Composer Create-project Laravel/laravel--prefer-dist

Install by downloading Laravel package

After the composer installation is complete, download the latest version of the Laravel framework and unzip it to a directory on your server. Then run the command line command in the root directory of the Laravel application, PHP Composer.phar install (or composer install) to install all the framework dependencies. In this process, to successfully complete the installation, you need to install Git on the server.

When the Laravel framework is installed, you can update the framework using command line commands for PHP composer.phar update.

Server environment Requirements

The Laravel framework has some system requirements:

PHP Minimum Version: 5.3.7
MCrypt PHP Extension
Starting with the PHP 5.5 version, installation packages for some operating systems require you to manually install the PHP JSON extension module. If you are using Ubuntu, you can install it directly via the Apt-get install Php5-json command. (Translator Note: or Ubuntu fool Ah!!!) )

Configuration

The Laravel framework is available for immediate use with virtually no configuration. You are free to start developing quickly. However, you may want to look at the app/config/app.php configuration file and related documentation first. It contains some configuration options that you might want to modify, such as time zones and regions.

Copy Code code as follows:

Once Laravel is installed, for your should also configure local your. This is allow to receive detailed error messages when developing on your local machine. By default, detailed error reporting be disabled in your production file.

Note:you should never have App.debug set to true for a production application. Never, ever do it.

Permission settings

The Laravel framework has a directory that requires additional permissions: You need to set write permissions for the files in the App/storage directory.

Path settings

Some of the framework directory paths can be set. If you need to change the location of these directories, you can view the settings in the bootstrap/paths.php file.

Elegant links

Apache Server

The Laravel framework removes the index.php in the link by setting the Public/.htaccess file. If your server is using Apache, please open the Mod_rewrite module.

If the. htaccess file that shipped with the frame does not work in your Apache environment, try this version:

Copy Code code as follows:

Options +followsymlinks
Rewriteengine on

Rewritecond%{request_filename}!-d
Rewriterule ^ (. +)/$ http://%{http_host}/$1 [r=301,l]

Rewritecond%{request_filename}!-f
rewriterule ^ index.php [L]

Nginx Server

If it is a Nginx server, the following instructions will be placed in the URL's configuration file, you can make the Web site more elegant:

Copy Code code as follows:

Location/{
Try_files $uri $uri//index.php $query _string;
}

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.