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 centos7.7 installs php7.3 's lnmp environment and composer

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces how centos7.7 installs php7.3 's lnmp environment and composer. It is very detailed and has a certain reference value. Interested friends must read it!

1. Update sourc

Yum update

two。 Install nginx

Yum install nginx

3. Start nginx

Service nginx start

4. Visit http:// your ip

If you want to configure the domain name, see the bottom.

5. Install mysql:

Install mysql source yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

Installation: yum install mysql mysql-server

Start: / etc/init.d/mysqld start or service mysqld restart

Reset password: mysql-u root-p

Probability error Can't connect to local MySQL server through socket'/ var/lib/mysql/mysql.sock' (2)

Reason: permission issu

Solution: sudo chown-R root:root / var/lib/mysql (both root can be changed to owner, but need to be consistent)

Restart the service

Service mysqld restart

Log in to mysql

Mysql-u root-p / / you can log in directly by pressing enter. There is no password just after installing mysql.

Modify mysql password

Use mysql

Lower version modification: update user set password=password ('your password') where user='root'

High version modification: update user set authentication_string = password ('your password'), password_expired = 'now', password_last_changed = now () where user = 'root'

Alter user 'root'@'localhost' identified by' your password

If the password is not strong enough, you can check the password level: SHOW VARIABLES LIKE "% password%"

Then set it to a low level: SET GLOBAL validate_password_policy=0

Finally quit.

Exit

Restart service mysqld restart

Allow remote access

1. Add the following command line if necessary to add the ability to connect remotely to root. The link password is' your password'

GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY' your password 'WITH GRANT OPTION

FLUSH PRIVILEGES

two。 Open the my.cnf file

Add a row of bind-address=0.0.0.0

3. Restart mysql

6. Install php

Yum install php php-devel / / php5.6 version

If you want to install 7.3

Install the EPEL source first

1.yum install epel-release / / install EPEL source 2.yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm / / install REMI source 3.yum install-y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl- Mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xml

The installation directory / etc/opt/remi/php73/ php.ini of 4.PHP is also in it.

Find the fix_pathinfo in php.ini and change it to 0 but cannot see phpinfo ()

Operation

Systemctl restart php73-php-fpm # restart systemctl start php73-php-fpm # start systemctl stop php73-php-fpm # turn off systemctl status php73-php-fpm # check status

7. Finally, update the extension after yum update updates the php resources when it is convenient

8. Install composer

Curl-sS https://getcomposer.org/installer | php73

Mv composer.phar / usr/local/bin/composer

Entering composer in this way will result in an error: / usr/bin/env: php: No such file or directory

Solution method

Cd usr/bin

Cp php73 php

Just enter composer.

Change the image to Aliyun: composer config-g repo.packagist composer https://mirrors.aliyun.com/composer/

9. Install git

Yum-y install git

10. Download the laravel framework

Composer create-project-- prefer-dist laravel/laravel project name "6.*"

Composer create-project-prefer-dist laravel/laravel laravelxs "6.*"

Modify the composer file.

Cd / root/.config/composer/ vi auth.json {"bitbucket-oauth": {}, "github-oauth": {}, "gitlab-oauth": {}, "gitlab-token": {"github.com": "token generated on git"}, "http-basic": {}, "bearer": {}}

Add

"github.com": "token generated on git"

Configuration of 11.nginx domain name

Create file: domain name .conf

The contents are:

Server {listen 80; server_name your domain name; access_log / var/log/nginx/access.log; error_log / var/log/nginx/error.log; index index.html index.htm index.php; root your project directory; location / {try_files $uri $uri/ / index.php$is_args$args } location ~. *\. (php | php5)? ${# fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_pass 127.0.0.1 fastcgi_connect_timeout 9000; fastcgi_connect_timeout 180; fastcgi_read_timeout 600; fastcgi_send_timeout 600; fastcgi_index index.php; fastcgi_split_path_info ^ ((? U). +\ .php) (/?. +) $ Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params;} location ~. *\. (gif | jpg | jpeg | png | bmp | swf) ${expires 30d;} location ~. *\. (html | htm | js | css)? ${expires 8h }} these are all the contents of the article "how centos7.7 installs php7.3 's lnmp environment and composer". Thank you for reading! Hope to share the content to help you, more related knowledge, 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

Internet Technology

Wechat

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

12
Report