centos 7 installed php

PHP (English name: PHP: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a versatile open source scripting language. Syntax absorbed the C language, Java, and Perl features conducive to learning, widely used, mainly for Web development. PHP syntax unique mix of C, Java, Perl and PHP own syntax. It can perform dynamic than the CGI or Perl pages more quickly. Compared with dynamic PHP pages made with other programming languages, PHP is embedded into HTML program (an application under the Standard Generalized Markup Language) document to execute, execute efficient than completely CGI generated HTML markup is much higher; PHP can also be performed after the compiled code, the compiler can optimize the code to achieve encryption and run, make the code run faster.

1. Check the current system version
CAT / etc / RedHat-Release
centos 7 installed php
2. Add User

groupadd www

useradd -g www -s /sbin/nologin -M www

3.yum安装依赖的程序包
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxm12-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel openssl openssl-devel libxslt-devel

4. Installation libiconv package
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
then decompresses tar zxf libiconv-1.15.tar., Gz
enter cd libiconv-1.15
compiler. / Configure --prefix = / usr / local / libiconv
the make the make the install &&

5. Configure-5.6.30.tar.gz compiled and installed the PHP
wget http://tw1.php.NET/get/php-5.6.30.tar.gz/from/this/mirror

Shear mv mirror php-5.6.30.tar.gz

Decompress tar xzvf php-5.6.30.tar.gz

编译./configure \
--prefix=/usr/local/php \
--enable-fpm \
--with-mysql=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-openssl \
--with-zlib \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--with-curl \
--enable-ftp \
--with-libxml-dir

make
make install

6. The arrangement correlation
cp php.ini-development /usr/local/php/lib/php.ini

php-fpm configuration

Copy php-fpm profile
cp -R ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

Php will give us ready init.d.php-fpm.

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

Add the php-fpm service to chkconfig list

chkconfig --add php-fpm

Set boot from the start

chkconfig php-fpm on

7. enter vim / etc / profile which
added to the end
centos 7 installed php
and then the PHP environment variables to take effect
source / etc / profile

8. Check php version
php -v

9. The CP SAPI / FPM / FPM-init.d.php /etc/init.d/php-fpm
10. The the chmod + X /etc/init.d/php-fpm
11. The start php-fpm # service php-fpm start

12. Then perform editing vim /usr/local/nginx/nginx.conf nginx profile
will change www www user
at a server / location module plus a index.php
the location ~ .php $ annotation module removed
to / scripts into $ document_root

修改完这些保存并退出,然后重启nginx: /usr/local/nginx/nginx -s stop /usr/local/nginx/nginx
接下来编辑一个测试的php程序,在nginx下的html目录下创建test.php文件,打印一下php配置: <?php  phpinfo();  ?>

**13.**cd 进入sbin

14../nginx

15../nginx -s reload

16. enter vim / etc / hosts
at the end of the domain name and add ip

17. In the windows in c: / system 32 / drivers / etc / hosts
added at the end of the domain name and ip

18. On the browser to access the network
centos 7 installed php

Guess you like

Origin blog.51cto.com/14259161/2417238