Detailed Explanation of Fast Installation Method of Laravel Framework in Local Virtual Machine

  • 2021-10-15 09:57:23
  • OfStack

This paper describes the method of fast installation of Laravel framework in local virtual machine. Share it for your reference, as follows:

1 straight want to learn larvael, can seem to find simple installation will waste a long time, maybe I am a novice relationship.

I am a local virtual machine installed linux system, centos7 plus php7

Step 1: To ensure that curl is installed correctly on your machine, please refer to the instructions in the appendix of this article for details

Step 2: Use curl to install composer. You should understand that composer is an php-based installation package management tool that serves the php ecosystem.

The installation command is as follows:


curl -sS https://getcomposer.org/installer | php

You must ensure the stability of the network, otherwise you will encounter a lot of trouble.

When the above composer is installed, you will be prompted for the directory where composer. phar is located, and then

Execute mv composer. phar/usr/local/bin/composer Add to Global Command, and then you can use composer using composer Simplified Command

Step 3: Install laravel:

When installing with root users, you may be prompted with any permission problems, and you need to adduser User name, add 1 user, and then passwd User name, add password, and then su Switch new user name to ordinary user

However, when installing laravel, unless you use smooth vpn, it is still slow, problem 1 heap.

At this time, you can switch the composer source to the domestic one. See composer domestic mirror https://pkg.phpcomposer.com/, and use any one method provided by official website to switch the source.

Then perform the composer create-project laravel/laravel your-project-name-prefer-dist "5.1.*" installation and replace your_project-name. The directory you want to install is followed by the version number, I use 5.1

When executing the above installation command, remember to enter the directory to install in advance, because the default is the directory to install under the current execution command.

Then wait quietly for the installation to succeed

phpunit/php-code-coverage suggests installing ext-xdebug ( > =2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpspec/phpspec suggests installing phpspec/nyan-formatters (~ 1.0 Adds Nyan formatters)
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
> php artisan key:generate
Application key [ey7saOCCJBcaRwsikqavNsVVdjGOA9tI] set successfully.

When the above occurs at last, the installation is successful.

Attachment: php7 compilation and installation under Linux centos7 environment php expansion package curl

First of all, this document is suitable for centos, php 7 versions installed on local virtual machines

After tossing for nearly one morning, the problem was finally solved

It is because after downloading curl and installing it, although the directory/usr/local/curl is established, phpize cannot be executed, because phpize must be executed at curl below ext below/lamp/php-7. 0.7, so as to live curl. so

php Source Directory:/lamp/php-7. 0.7

php Compile Directory:/usr/local/php/

curl Source Directory:/root/curl-7. 32.0

1. curl, which is mainly used to send http requests, is an extension packet of php.

2. Installation process:

(1) curl Download: http://curl.haxx.se/download.html

(2) Specific installation process:


wget http://curl.haxx.se/download/curl-7.32.0.tar.gz
tar zxvf curl-7.32.0.tar.gz
cd curl-7.32.0
./configure --prefix=/usr/local/curl
cd / ( php Source directory, not php Compile directory) /ext/curl

To run phpize:


/ ( php Compile directory) /bin/phpize
./configure --with-php-config=/ ( php Compile directory) /bin/php-config --with-curl=/ ( curl Source Directory) 

Take mine as an example:


./configure --with-php-config=/usr/local/php/bin/php-config --with-curl=/usr/local/curl
make && make install

Modify php. ini by adding: extension=curl.so (If no other php extensions are installed, you need to configure extension_dir= "/(php compiled directory) /lib/php/extensions/no-debug-non-zts-20121212/" at the same time. The extension_dir directory will be output when the. so file was generated in the previous step.)

(3) Check whether the installation is successful:

/(php Compiled Directory)/bin/php-m grep curl-If curl is printed normally, the installation is successful (php-m will print out the installed extension module)

3. Pits stepped on:

(1) Run phpize directly at the top of the source directory of curl, prompting the following error:

Cannot find config.m4.
Make sure that you run '/home/zhuyx/local/php-5.5.3/bin/phpize' in the top level source directory of the module

Reason:

phpize extension installation, the source package needs config. m4 configuration file; The source package of the current extension is not included (memcache is included).

Solution:

(1) Run phpize under ext/curl of php source package, and then install

(2)./configure-with-php-config=/php/bin/php-config-with-curl=curl Source Directory

Problem expansion:

If you encounter similar problems when installing other php extensions, you can take the above solution.

(2) About php. ini

Landlord 1 started to modify the php compiled directory/lib/php. ini this file, after the modification of the new module does not take effect. Later, I learned that the previous one is the default (not specified at compile time) extended configuration directory. If the directory of php. ini is specified at compile time, it is necessary to modify php. ini under the specified directory in the future. For example, the landlord is php compiled direction/php. ini.

(3) Call curl() The php script, the command line can be run, and the browser access prompt is the following error:

Fatal Error: Call to undefined function curl ()

Reason:

The landlord's server is nginx. After installing curl extension, php-fpm was not restarted.

Solution:

Restart php-fpm.
ps aux grep php-fpm (find master process)
kill-SIGINT master process
Enter php-5. 5.3/sbin and execute./php-fpm (boot)

More readers interested in Laravel can check the topics on this site: "Introduction and Advanced Tutorial of Laravel Framework", "Summary of Excellent Development Framework of php", "Introduction Tutorial of php Object-Oriented Programming", "Introduction Tutorial of php+mysql Database Operation" and "Summary of Common Database Operation Skills of php"

I hope this article is helpful to the PHP programming based on Laravel framework.


Related articles: