centos7 + php7 lamp full set of latest version configuration and mongodb and redis tutorial details
- 2020-05-12 06:39:14
- OfStack
All software version 1 will be updated, so be aware that the current version has been updated.
First put centos7
If you forgot to set the swap partition, here's how to add one:
https://www.ofstack.com/os/201409/338170.html
After installing centos7, the Internet cannot be accessed by default
cd /etc/sysconfig/network-scripts/
Find the file in the form ifcfg-enp0s3 and modify onboot=yes
then
service network restart
Install apache2 (httpd in centos)
yum install httpd
Start the apache2
service httpd start
Let's see if it works
curl http://localhost
Set the boot to run automatically
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 yum is installed
yum install php70w
Restart apache
service httpd restart
Look at the phpinfo
service network restart
0
Visit http: / / localhost info php
php 7.0.x is OK
Install mysql5. 7
Update the source first
service network restart
1
The installation
service network restart
2
mysql5.7 the initial password is no longer empty, it will tell you the password file address in shell output, 1 normally under ~/.mysql_secret
If this file is unfortunately not available, it is not impossible to do so.
http://blog.csdn.net/qq_26941173/article/details/51548947
Setup startup:
chkconfig mysqld on
Install the mysql extension for php7
service network restart
4
Restart apache2 to take effect
Install the latest version of mongodb
The instructions on mongodb's official website are very detailed. Just follow them:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/
Install the mongo extension for php7
I'm going to load a bunch of stuff
service network restart
5
The mongodb extension of php7 is then installed via pecl
service network restart
6
or
service network restart
7
The mongo is an older version that will not be updated now, but a lot of the history code is in use. mongodb is an extension of the new version, officially recommended.
Don't forget php.ini plus
extension= mongo.so or extension= mongodb.so and restart apache2
To install redis1 of
I can't use yum.
http://redis.io/download Download the latest version (currently available 3.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
make may be prompted Hint: It's a good idea to run make test'
Then run make test and you may be prompted that tcl is not installed
service network restart
9
make test and then make
---
Error 2:error: jemalloc/jemalloc.h: No such file or directory is also possible
Reason :1 some compilation dependencies or problems left over from the original compilation
Solution :make distclean clean 1, then make.
---
After successful installation, the src directory will have more executables such as redis-server, redis-cli and so on
./src/redis-server server
. / src/redis - cli client
Install the redis extension for php7
pecl install redis
Modify php.ini to add extension= redis.so, then restart apache2
PS1:
If yum prompts xxx not signed, add the parameter --nogpgcheck
Well, that's the end of this article.