Quickly build LAMP server environment

Quickly build LAMP server environment

Software Environment

CentOS 6.8 64 Wei

First, build the MySQL database

1,  yum install MySQL:

yum install mysql-server -y

After normal completion of execution, as shown below:

 

2, the installation is complete, start the MySQL service:

service mysqld restart

3, set the MySQL root account password:

/ usr / bin / mysqladmin -u the root password ' MYSQL Based password '

 

Second, install the Apache Service

1,  yum the installation Apache

yum install httpd -y

After normal completion of execution, as shown below:

2, start the Apache service:

service httpd start

 

Third, install PHP and PHP-MYSQL Support Tools

1,  yum install PHP

yum install php php-mysql -y

Note: The default installation of PHP version 5.3.3, how require higher versions, such as PHP7.2

1.1 update yum source

Delete the previous version of php

# yum remove php* php-common 
 

rpm installation Php7 respective source yum

CentOS/RHEL 7.x:

# 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


CentOS/RHEL 6.x:
# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

1.2 安装PHP7.2

yum install php72w

1.3 安装PHP7.2的扩展,根据自己需求来

php72w-cli 
php72w-common 
php72w-devel 
php72w-embedded 
php72w-fpm 
php72w-gd 
php72w-mbstring 
php72w-mysqlnd 
php72w-opcache 
php72w-pdo 
php72w-xml 
php72w 
php72w-bcmath 
php72w-dba 
php72w-enchant 
php72w-imap 
php72w-interbase
php72w-intl 
php72w-ldap  
php72w-mcrypt 
php72w-odbc 
php72w-pdo_dblib 
php72w-pear 
php72w-pecl-apcu 
php72w-pecl-imagick 
php72w-pecl-xdebug 
php72w-pgsql 
php72w-phpdbg 
php72w-process 
php72w-pspell 
php72w-recode 
php72w-snmp 
php72w-soap 
php72w-tidy 
php72w-xmlrpc 
php72w-pecl-igbinary 
php72w-intl 
php72w-memcached 
php72w-pecl-mongodb

 1.4 安装完成的查看php的版本,如下图所示:

php -v

四、检查安装是否成功

我们在 /var/www/html 目录下创建一个info.php文件(<?php phpinfo(); ?>)来检查php是否安装成功! 

浏览器访问:http://IP地址或域名/info.php

Guess you like

Origin www.cnblogs.com/zhangzhijian/p/11137193.html