PHP source installation, simple configuration, testing and database connection

Source: Internet
Author: User
Tags bz2 fpm gettext gmp install php openssl pear snmp

Host Environment redhat6.5 64-bit

Lab Environment Server ip172.25.29.1 PHP

installation package php-5.6.20.tar.bz2

re2c-0.13.5-1.el6.x86_64.rpm

libmcrypt-2.5.8-9.el6.x86_64.rpm

libmcrypt-devel-2.5.8-9.el6.x86_64.rpm

Discuz_x3.2_sc_utf8.zip

1. Install PHP

1. Unzip

[[email protected] mnt# tar jxf php-5.6.20.tar.bz2 # Unzip

[email protected] php-5.6.20]# RPM-VIH libmcrypt-* # Installing the Libmcrypt library

[email protected] php-5.6.20]# Yum Installre2c-0.13.5-1.el6.x86_64.rpm–y # Installing RE2C

2. software configuration

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/BF/wKioL1fg3BKhcQISAAAXa_t5IDE930.png "style=" float: none; "title=" 1.png "alt=" Wkiol1fg3bkhcqisaaaxa_t5ide930.png "/>

[email protected] php-5.6.20]# Yum install libxml2-devel-y

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/BF/wKioL1fg3BLRRAslAAAkT7CE3-Q302.png "title=" 2.png " Style= "Float:none;" alt= "Wkiol1fg3blrraslaaakt7ce3-q302.png"/>

[email protected] php-5.6.20]# Yum provides */easy.h

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/C3/wKiom1fg3BOw1uxUAADeoGw6Pes727.png "title=" 3.png " Style= "Float:none;" alt= "Wkiom1fg3bow1uxuaadeogw6pes727.png"/>

[email protected] php-5.6.20]# Yum install-ylibcurl-devel-7.19.7-37.el6_4.x86_64

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/87/BF/wKioL1fg3BPx1-OOAAAkdoMrA-w527.png "title=" 4.png " Style= "Float:none;" alt= "Wkiol1fg3bpx1-ooaaakdomra-w527.png"/>

[email protected] php-5.6.20]# Yum provides */jpeglib.h

[email protected] php-5.6.20]# Yum install-ylibjpeg-turbo-devel-1.2.1-1.el6.x86_64

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/C3/wKiom1fg3BPCD2SvAAAc6x3PeUc224.png "title=" 5.png " Style= "Float:none;" alt= "Wkiom1fg3bpcd2svaaac6x3peuc224.png"/>

[email protected] php-5.6.20]# Yum provides */png.h

[email protected] php-5.6.20]# Yum install-ylibpng-devel-1.2.49-1.el6_2.x86_64

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/C3/wKiom1fg3BTRFxwVAAAjiP-8FRU627.png "title=" 6.png " Style= "Float:none;" alt= "Wkiom1fg3btrfxwvaaajip-8fru627.png"/>

[email protected] php-5.6.20]# Yum install-y freetype-devel

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/BF/wKioL1fg3BTAV8ucAAAeb870Br0310.png "title=" 7.png " Style= "Float:none;" alt= "Wkiol1fg3btav8ucaaaeb870br0310.png"/>

[email protected] php-5.6.20]# Yum provides */gmp.h

[email protected] php-5.6.20]# Yum install-y gmp-devel-4.3.1-7.el6_2.2.x86_64

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

If the following error occurs

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/BF/wKioL1fg3BTg6_lXAAAfPqitHAA979.png "title=" 8.png " Style= "Float:none;" alt= "Wkiol1fg3btg6_lxaaafpqithaa979.png"/>

[email protected] php-5.6.20]# Yum install-y net-snmp-devel

Re-configure

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--with-openssl--with-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir- -with-freetype-dir--with-gettext--without-pear--with-gmp--enable-inline-optimization--enable-soap--enable-ftp- -enable-sockets--enable-mbstring--with-mysqli--with-mysql--with-pdo-mysql--enable-fpm--with-fpm-user=nginx-- With-fpm-group=nginx--with-mcrypt--with-mhash

3. Compiling, linking, installing

[[email protected] php-5.6.20]# make # compiling

[[email protected] php-5.6.20]# make install # installation

2.php The simple configuration

[Email protected] php-5.6.20]# cd/usr/local/lnmp/php/etc/

[[email protected] etc]# ls

Php-fpm.conf.default

[email protected] etc]# CP php-fpm.conf.default php-fpm.conf # backing up PHP files

[[email protected] etc]# ls

Php-fpm.conf Php-fpm.conf.default

[email protected] etc]# cp/mnt/php-5.6.20/php.ini-production php.ini #php the configuration file

[[email protected] etc]# ls

php-fpm.conf Php-fpm.conf.default php.ini


If you are connecting to a database, make the following changes

[Email protected] etc]# vim php.ini

925 date.timezone = Asia/shanghai # Modify Time Zone

1001 Pdo_mysql.default_socket=/usr/local/lnmp/mysql/data/mysql.sock # specify the path to the sock file that connects to the database

1150 mysql.default_socket =/usr/local/lnmp/mysql/data/mysql.sock # Ibid .

1209 Mysqli.default_socket =/usr/local/lnmp/mysql/data/mysql.sock # Ibid .

[Email protected] etc]# vim php-fpm.conf

pid = run/php-fpm.pid # remove the PID marker

[Email protected] etc]# cd/mnt/php-5.6.20/sapi/fpm/

[[email protected] fpm]# CP INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM # Add Start command

[email protected] fpm]# chmod +x/etc/init.d/php-fpm # Add executable Permissions

[Email protected] fpm]# LL/ETC/INIT.D/PHP-FPM

-rwxr-xr-x 1 root root 2359 Sep 00:18/etc/init.d/php-fpm

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

Starting php-fpm Done

[Email protected] fpm]# cd/usr/local/lnmp/nginx/conf/

[Email protected] conf]# vim nginx.conf

the root HTML;

index.php index index.html index.htm; # Add default Access directory in Nginx to PHP first

Location/{

53}

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.conf; # set to a file that already exists

81}

[email protected] conf]# Nginx–t # Detection

[[email protected] conf]# Nginx # Open

[Email protected] conf]# CD.

[[Email protected] nginx]# CD HTML

[email protected] html]# Vim index.php # write a simple test file

<?php

Phpinfo ()

?>

[[email protected] html]#/etc/init.d/httpd start # Open httpd

Starting httpd: [OK]

3. test 172.25.29.1

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/87/C3/wKiom1fg3BXTZUJ0AAEBrG0SO5Y178.png "title=" 9.png " Style= "Float:none;" alt= "Wkiom1fg3bxtzuj0aaebrg0so5y178.png"/>


This article from "Do not forget beginner's mind, Party always" blog, please be sure to keep this source http://12087746.blog.51cto.com/12077746/1854495

PHP source installation, simple configuration, testing and database connection

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.