English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

centos7 + php7 Detailed Explanation of the Configuration of the Latest Version of LAMP and MongoDB and Redis Tutorials

The versions of all software will always be upgraded, pay attention to whether your current version has been updated.

First, install centos7

If you forgot to set up the swap partition, the following article can teach you how to add one:

https://www.oldtoolbag.com/os/201409/338170.html

install centos7after that, the default is that you cannot go online

cd /etc/sysconfig/network-scripts/

find a file like ifcfg-enp0s3modify onboot=yes in the file

then

service network restart

install apache2 (in CentOS it is called httpd)

yum install httpd

start apache2

service httpd start

check if it has taken effect

curl http://localhost

set to run automatically at boot

chkconfig httpd on

Install php7

first, update the source

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

or

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

then install

yum install php70w

restart apache

service httpd restart

check phpinfo

vi /var/www/html/info.php
<?php phpinfo(); ?>

access http://localhost/info.php

see php7.0.x information is OK

install mysql5.7

update the source first

rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

install

yum install mysql-community-server

mysql5.7the initial password is no longer empty, it will tell you the password file address in the shell output, usually in ~/under .mysql_secret

if this file is unfortunately not available, there is still a way, follow the steps below:

http://blog.csdn.net/qq_26941173/article/details/51548947

set to boot automatically:

chkconfig mysqld on

Install php7mysql extension

yum install php70w-mysql

restart apache2take effect

install the latest version of mongodb

the instructions on the mongodb official website are very detailed, just follow the steps:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

Install php7mongo extension

first, install a lot of things

yum install php-pear
yum install php-devel
yum -y install gcc
yum install openssl openssl-devel
pecl channel-update pecl.php.net

then install php through pecl7mongodb extension

pecl install mongo

or

pecl install mongodb

mongo is an old version and will not be upgraded anymore, but many historical codes are still in use. mongodb is the new version of the extension, recommended by the official.

Don't forget to add it to php.ini

extension=mongo.so or extension=mongodb.so and restart apache2

Install a set of redis

Can't use yum anymore, very unpleasant.

http://redis.io/download the latest version (currently3.2.5)
wget http://download.redis.io/releases/redis-3.2.5.tar.gz
tar xzf redis-3.2.5.tar.gz
cd redis-3.2.5

make

After make, you may be prompted with 'Hint: It's a good idea to run 'make test'

Then run make test, which may prompt that tcl is not installed

yum install -y tcl

Re-run make test then make

---

Errors may also occur2:error: jemalloc/jemalloc.h: No such file or directory

Reason: Some compilation dependencies or problems left over from previous compilations

Solution: make distclean clean up, and then make.

---

After installation, the src directory will have an additional redis-server, redis-cli and other executable files

./src/redis-server server-side

./src/redis-cli client

Install php7redis extension

pecl install redis

Modify php.ini by adding extension=redis.so and then restart apache2

PS1:

If you are prompted with 'xxx not signed' when using yum, add the parameter --nogpgcheck

That's all for this article.

You May Also Like