centos7.0 Yum Install PHP server

Source: Internet
Author: User
Tags install php ldap pear php server

50923900

First of all: centos7.0 installs Apache directly with Yum, PHP their default version is apache2.4 and php5.4
1, before the installation check whether the system has a default installed Apache or PHP

Rpm-qa | grep httpd
Rpm-qa | Frep PHP

2, the above instructions listed in the package to delete

Rpm-e * * * * (package name)

3, before the installation, update the system

Yum Update

4. Install some necessary packages

Yum-y Install GCC
Yum-y Install gcc-c++
Yum-y Install make

Because Yum installs all dependent packages together, so you don't have to rely on packages, worry
5. Start installing Apache

Yum Install httpd

6, now go to the browser to enter the server's IP, normal situation you can not access, because there is no firewall by default on the 80 port is open, so now to open the firewall to 80 ports open

Yum Install iptables-services-iptables firewall
vi/etc/sysconfig/iptables-– Modifying configurations
-A input-m state–state new-m tcp-p tcp–dport 80-j ACCEPT #允许80端口通过防火墙 1
-A input-m state–state new-m tcp-p tcp–dport 3306-j ACCEPT #允许3306端口通过防火墙 2
Save 1, 22 rules to the open profile, note: to be placed under port 20
Systemctl Restart firewalld.service--reboot firewall

7, now go to visit, if the success of that OK or not, to change the meaning of httpd.conf configuration

Find/-name httpd.conf– If the httpd.conf file is not found
Find servername-– changed to: ServerName localhost:80
Restart: systemctl Restart Httpd.service
Systemctl Enable Httpd.service #设置apache开机启动

8 now go to visit no accident should appear

is work--done

9. Install PHP

Yum-y Install PHP-GD php-xml php-mbstring php-ldap php-pear php-xmlrpc– default is php5.4

10, installation php7.0

RPM-UVH https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Yum-y Install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 Php70w-pear.noarch php70w-process.x86_64 Php70w-xml.x86_64 php70w-xmlrpc.x86_64
To install php5.6, change the above 70 to 56 and 55 is 5.5.

11. Install PHP FPM

Yum Install PHP55W-FPM
Yum Install PHP56W-FPM
Yum Install PHP70W-FPM

12, write a test php file Phpinfo () see if you can output PHP information, if not, or the file is downloaded directly, indicating that Apache does not support PHP this time you have to modify/etc/httpd/conf/httpd.conf

centos7.0 Yum installation is supported by default if PHP is not supported:
Found: Include conf.modules.d/*.conf
If not, add one.

13 Installing MySQL

Yum-y Install MYSQL-CONNECTOR-ODBC mysql-devel libdbi-dbd-mysql

14, seems to be loaded, but this is not possible, there are changes to httpd configuration files, to solve some security problems

14.1, allowoverride none--allowoverride all--allow domain redirection
14.2, Options Index followsymlinks--options followsymlinks-prohibit Apache display directory
14.3, traceenable off ——-best to add otherwise the security scan will not pass, the homepage is prohibited Apache what remote access what ghosts Forget

15, SELinux Authority issues important issues I've been doing for a long time
1, the cache file is not writable problem

Semanage fcontext-a-T httpd_sys_rw_content_t "project path (/.*)?"
Restorecon-r Project Path
* If Semanage command not yum-y install Policycoreutils-python

If the above method is not possible (I did not succeed) then you can just turn selinux off.
Modify Configuration
Setenforce 0-Zero shutdown (restart machine failure)
Permanently close modify/etc/selinux/config file
Change Selinux=enforcing to Selinux=disabled
Restart the machine to Shutdown-r now

16. Install PHP to support Redis extensions

Download Phpredis Package
TAR-ZXVF Package Name
/usr/bin/phpize
./configure–with-php-config=php-config path you can find/-name php-config View the path
Make
Make && Install
Appearance: Installing Shared extensions:/usr/lib/php/modules/
This means that you have successfully installed, go to see (I mean the above system shown in the directory) there is no redis.so
If there is, then Whereis php.ini find php.ini and finally add extension=redis.so
Restart the httpd on the line.

JPG change rar

centos7.0 Yum Install PHP server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.