Linux System installation Configuration PHP service

Source: Internet
Author: User
Tags configuration php install php mcrypt

Introduction :

PHP (foreign name: Php:hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. The grammar absorbs the C language, Java and Perl features, is conducive to learning, widely used, mainly for the field of web development.

You need to install the following installation packages: (You can use the network Yum source installation, most of this tutorial uses the downloaded source installation for compiling and installing)

Callout: First configure the network Yum source to install the following four PHP dependency packages online, configure the network yum Source Tutorial:

Http://www.cnblogs.com/zoulongbin/p/5773330.html

[[email protected] src]# yum-y install Libcurl-devel (must be installed)

[[email protected] src]# yum-y install Libxpm-devel (must be installed)

[[email protected] src]# yum-y install Libxml2-devel (must be installed)

[[email protected] src]# yum-y install php-mbstring (optional installation)

annotations: downloaded software installation package Unified Storage path under the/USR/LOCAL/SRC directory for decompression and compilation installation

1, installation Yasm

:http://www.tortall.net/projects/yasm/releases/

[Email protected] src]# CD yasm-1.3.0

[Email protected] yasm-1.3.0]# ./configure

[[email protected] yasm-1.3.0]# make

[[email protected] yasm-1.3.0]# make install

2, Installation Libmcrypt

:https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

[Email protected] src]# CD libmcrypt-2.5.8

[Email protected] libmcrypt-2.5.8]# ./configure

[[email protected] libmcrypt-2.5.8]# make

[[email protected] libmcrypt-2.5.8]# make install

3, Installation LIBVPX

: http://www.linuxfromscratch.org/blfs/view/svn/multimedia/libvpx.html

[Email protected] src]# CD libvpx-1.6.0

[Email protected] libvpx-1.6.0]#/configure--prefix=/usr/local/libvpx--enable-shared--enable-vp9

[[email protected] libvpx-1.6.0]# make

[[email protected] libvpx-1.6.0]# make install

4. Installing TIFF

: http://download.osgeo.org/libtiff/

[Email protected] src]# CD tiff-4.0.6

[Email protected] tiff-4.0.6]#/configure--prefix=/usr/local/tiff--enable-shared

[[email protected] tiff-4.0.6]# make

[[email protected] tiff-4.0.6]# make install

5, installation Libpng

:http://www.libpng.org/pub/png/libpng.html

[Email protected] src]# CD libpng-1.6.28

[Email protected] libpng-1.6.28]#/configure--prefix=/usr/local/libpng--enable-shared

[[email protected] libpng-1.6.28]# make

[[email protected] libpng-1.6.28]# make install

6, Installation FreeType

:http://ring.u-toyama.ac.jp/archives/graphics/freetype/freetype2/

[Email protected] src]# CD freetype-2.7.1

[Email protected] freetype-2.7.1]#/configure--prefix=/usr/local/freetype--enable-shared

[[email protected] freetype-2.7.1]# make

[[email protected] freetype-2.7.1]# make install

7. Install JPEG

:http://www.ijg.org/files/

[Email protected] src]# CD jpeg-9a

[Email protected] jpeg-9a]#/configure--prefix=/usr/local/jpeg--enable-shared

[[email protected] jpeg-9a]# make

[[email protected] jpeg-9a]# make install

8, installation LIBGD

:https://github.com/libgd/libgd/releases

[Email protected] src]# CD libgd-2.2.0

[Email protected] libgd-2.2.0]#/configure--prefix=/usr/local/libgd--enable-shared--with-jpeg=/usr/local/ JPEG--with-png=/usr/local/libpng--with-freetype=/usr/local/freetype--with-fontconfig=/usr/local/freetype-- with-xpm=/usr/--with-tiff=/usr/local/tiff--with-webp=/usr/local/libwebp/

[[email protected] libgd-2.2.0]# make

[[email protected] libgd-2.2.0]# make install

9, installation T1lib

:http://download.csdn.net/download/sunkaivg/9696064

[Email protected] src]# CD t1lib-5.1.2

[Email protected] t1lib-5.1.2]#/configure--prefix=/usr/local/t1lib--enable-shared

[email protected] t1lib-5.1.2]# make without_doc

[[email protected] t1lib-5.1.2]# make install

10. Install PHP

:http://www.php.net/downloads.php

[[email protected] src]# ls

php-7.1.0 php-7.1.0.tar.gz

[Email protected] src]# pwd

/usr/local/src

[Email protected] src]# CD php-7.1.0

[Email protected] php-7.1.0]# /configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc-- With-pdo-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/ Mysql.sock--with-pdo-mysql=/usr/local/mysql--with-gd--with-png-dir=/usr/local/libpng--with-jpeg-dir=/usr/local /jpeg--with-freetype-dir=/usr/local/freetype--with-xpm-dir=/usr/--with-zlib-dir=/usr/local/zlib--with-iconv-- Enable-libxml--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization-- Enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl-- Enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-session --with-mcrypt--with-curl--enable-ctype

[[email protected] php-7.1.0]# make

[[email protected] php-7.1.0]# make install

One , configure PHP

[Email protected] src]# pwd

/usr/local/src

[[email protected] src]# ls

php-7.1.0 php-7.1.0.tar.gz

[Email protected] src]# CD php-7.1.0

[Email protected] php-7.1.0]# CP Php.ini-production/usr/local/php/etc/php.ini

[Email protected] php-7.1.0]# Rm-rf/etc/php.ini

[Email protected] php-7.1.0]# ln-s/usr/local/php/etc/php.ini/etc/php.ini

[Email protected] php-7.1.0]# ls-l/etc/php.ini

lrwxrwxrwx 1 root root 6 02:22/etc/php.ini-/usr/local/php/etc/php.ini

[Email protected] php-7.1.0]# cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf /c1>

[Email protected] php-7.1.0]#ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf

[Email protected] php-7.1.0]# vim/usr/local/php/etc/php-fpm.conf

: wq! Exit and save

[Email protected] php-7.1.0]# cd/usr/local/php/etc/php-fpm.d/

[[email protected] php-fpm.d]# ls

Www.conf.default

[Email protected] php-fpm.d]# CP www.conf.default www.conf

[[email protected] php-fpm.d]# ls

Www.conf Www.conf.default

[Email protected] php-fpm.d]# pwd

/usr/local/php/etc/php-fpm.d

[Email protected] php-fpm.d]# vim www.conf

:wq! #保存退出

A , set php-fpm boot from

[Email protected] ~]# cp/usr/local/src/php-7.1.0/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm

[Email protected] ~]# ls-l/etc/init.d/php-fpm

-rw-r--r--1 root root 2401 Jan 6 20:58/etc/init.d/php-fpm

[Email protected] ~]# chmod 755/etc/init.d/php-fpm

[Email protected] ~]# ls-l/etc/init.d/php-fpm

-rwxr-xr-x 1 root root 2401 Jan 6 20:58/etc/init.d/php-fpm

[Email protected] ~]# chkconfig php-fpm on

[Email protected] ~]# chkconfig--list php-fpm

PHP-FPM 0:off 1:off 2:on 3:on 4:on 5:on 6:off

[Email protected] ~]# Vim/usr/local/php/etc/php.ini

Found:disable_functions =

Modified into disable_functions= passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_ Status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server, Escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space, Posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_ Getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam, Posix_getpwuid, Posix_getrlimit,posix_getsid,posix_getuid,posix_isatty, Posix_kill,posix_mkfifo,posix_setegid, Posix_seteuid,posix_setgid, Posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname, Posix_uname

Found:date.timezone =

Modified to:Date.timezone = PRC #设置时区

Found:expose_php = on

Modified to:expose_php = Off #禁止显示php版本的信息

Found:Short_open_tag = Off

Modified to:Short_open_tag = on #支持php短标签

Find opcache.enable=0

Modified to opcache.enable=1 #php支持opcode缓存

Found:opcache.enable_cli=1 #php支持opcode缓存

Modified to:opcache.enable_cli=0

Add:zend_extension=opcache.so #开启opcode缓存功能 on the last line (you can jump to the last line by pressing SHIFT+G in the text)

: wq! #保存退出

- , configure Nginx support PHP

[Email protected] ~]# vim/usr/local/nginx/conf/nginx.conf

User www www;

#首行user去掉注释, modify the Nginx run group to www www; must be the same as the User,group configuration in/usr/local/php/etc/php-fpm.d/www.conf, or PHP will run in error

Location/{

root HTML;

Index index.html index.htm index.php; #添加index. php

}

Location ~ \.php$ {

root HTML;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}

#取消FastCGI the comment for the Server section location, note the parameters of the Fastcgi_param line, change to $document_root$fastcgi_script_name, or use the absolute path

: wq! #退出并保存

[Email protected] php-fpm.d]# /etc/init.d/nginx Restart

[[email protected] php-fpm.d]# /etc/init.d/php-fpm start

- , test PHP configuration

[Email protected] ~]# cd/usr/local/nginx/html/

[[email protected] html]# ls

50x.html index.html

[Email protected] html]# rm-rf/usr/local/nginx/html/*

[Email protected] html]# pwd

/usr/local/nginx/html

[Email protected] html]# vim index.php

<?php

Phpinfo ();

?>

: wq! Save and exit

[Email protected] html]# chown www.www/usr/local/nginx/html/-R

[Email protected] html]# chmod 755/usr/local/nginx/html/-R

Open the browser to enter the server IP address, you will see the following interface is a successful PHP installation

Linux System installation Configuration PHP service

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.