Centos7 x84_64 on yum install PHP and Nginx

Source: Internet
Author: User
Tags ioncube

1, install Epel source

Yum Install-y epel-release

2, update

Yum Update-y

3, add Nginx source

cd/etc/yum.rep.d/

VI Nginx.repo

[Nginx]

Name=nginx Repo

baseurl=http://nginx.org/packages/centos/$releasever/$basearch/

Gpgcheck=0

Enabled=1


3, install Nginx

Yum install-y Nginx

4. Install PHP and its associated libraries

Yum install-y php php-mysql php-fpm php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap C URL Curl-devel


5, add PHP encryption Extension Module

wget http://www.dmasoftlab.com/cont/download/ioncube_loaders_lin_x86-64.tar.gz

Tar zxvf ioncube_loaders_lin_x86-64.tar.gz

CP-RF ioncube/usr/local/


6, configure PHP

Cp/etc/php.ini/etc/php.ini.bk


Sed-i ' s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g '/etc/php.ini

Sed-i ' s/post_max_size = 8m/post_max_size = 50m/g '/etc/php.ini

Sed-i ' s/upload_max_filesize = 2m/upload_max_filesize = 50m/g '/etc/php.ini

Sed-i ' s/;d ate.timezone =/date.timezone = prc/g '/etc/php.ini

Sed-i ' s/; Cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g '/etc/php.ini

Sed-i ' s/; Cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g '/etc/php.ini

Sed-i ' s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g '/etc/php.ini

Sed-i ' s/max_execution_time = 30/max_execution_time = 300/g '/etc/php.ini

Sed-i ' s/disable_functions =.*/disable_functions = Passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc _open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_ Socket_server/g '/etc/php.ini


echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_5.4.so" >>/etc/php.ini


Cp/etc/php-fpm.d/www.conf/etc/php-fpm.d/www.conf.bk

Vi/etc/php-fpm.d/www.conf


#修改用户为nginx

user = Nginx

#修改组为nginx

Group = Nginx


7, set boot start

Systemctl Enable Php-fpm.service

Open PHP-FPM Service

Systemctl Start PHP-FPM


8, configuring Nginx

Vi/etc/nginx/conf.d/default.conf

#location/{

root/usr/share/nginx/html;

Index index.php index.html index.htm;

#}

Modify the following code

# location ~ \.php$ {

# root HTML;

# Fastcgi_pass 127.0.0.1:9000;

# Fastcgi_index index.php;

# Fastcgi_param Script_filename/scripts$fastcgi_script_name;

# include Fastcgi_params;

#}

Remove the #,/scripts from the root line and change to $document_root


9, power-on self-start

Systemctl Enable Nginx.service

Systemctl Restart Nginx


10, test


vi/usr/share/nginx/html/index.php

<?php

Phpinfo ();

?>


Http://YOURSERVERIP See the PHP configuration information is OK.


Centos7 x84_64 on yum install PHP and Nginx

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.