Php source code installation, simple configuration, testing and database connection
Host environment redhat6.5 64-bit
Experimental environment server ip172.25.29.1 php
Install 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. Decompression
[root@server1 mnt# tar jxf php-5.6.20.tar.bz2 # decompress
[root@server1 php-5.6.20] # rpm-vih libmcrypt-* # install libmcrypt library
[root@server1 php-5.6.20] # yum installre2c-0.13.5-1.el6.x86_64.rpm-y # install re2c
two。 Software configuration
[root@server1 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
[root@server1 php-5.6.20] # yum install libxml2-devel-y
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum provides * / easy.h
[root@server1 php-5.6.20] # yum install-ylibcurl-devel-7.19.7-37.el6_4.x86_64
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum provides * / jpeglib.h
[root@server1 php-5.6.20] # yum install-ylibjpeg-turbo-devel-1.2.1-1.el6.x86_64
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum provides * / png.h
[root@server1 php-5.6.20] # yum install-ylibpng-devel-1.2.49-1.el6_2.x86_64
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum install-y freetype-devel
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum provides * / gmp.h
[root@server1 php-5.6.20] # yum install-y gmp-devel-4.3.1-7.el6_2.2.x86_64
Reconfigure
[root@server1 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
[root@server1 php-5.6.20] # yum install-y net-snmp-devel
Reconfigure
[root@server1 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. Compile, link, install
[root@server1 php-5.6.20] # make # compilation
[root@server1 php-5.6.20] # make install # installation
Simple configuration of 2.php
[root@server1 php-5.6.20] # cd / usr/local/lnmp/php/etc/
[root@server1 etc] # ls
Php-fpm.conf.default
[root@server1 etc] # cp php-fpm.conf.default php-fpm.conf # backup php files
[root@server1 etc] # ls
Php-fpm.conf php-fpm.conf.default
[root@server1 etc] # cp / mnt/php-5.6.20/php.ini-production php.ini # php configuration file
[root@server1 etc] # ls
Php-fpm.conf php-fpm.conf.default php.ini
If you want to connect to the database, make the following changes
[root@server1 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 # ditto
1209 mysqli.default_socket = / usr/local/lnmp/mysql/data/mysql.sock # ditto
[root@server1 etc] # vim php-fpm.conf
25 pid = run/php-fpm.pid # remove the tag from pid
[root@server1 etc] # cd / mnt/php-5.6.20/sapi/fpm/
[root@server1 fpm] # cp init.d.php-fpm / etc/init.d/php-fpm # add startup command
[root@server1 fpm] # chmod + x / etc/init.d/php-fpm # add executable permissions
[root@server1 fpm] # ll / etc/init.d/php-fpm
-rwxr-xr-x 1 root root 2359 Sep 18 00:18 / etc/init.d/php-fpm
[root@server1 fpm] # / etc/init.d/php-fpm start # enable php service
Starting php-fpm done
[root@server1 fpm] # cd / usr/local/lnmp/nginx/conf/
[root@server1 conf] # vim nginx.conf
51 root html
52 index index.php index.html index.htm; # add the default access directory in nginx to php first
50 location / {
53}
75 location ~\ .php$ {
76 root html
77 fastcgi_pass 127.0.0.1:9000
78 fastcgi_index index.php
79 fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name
80 include fastcgi.conf; # set to an existing file
81}
[root@server1 conf] # nginx-t # detection
[root@server1 conf] # nginx # enable
[root@server1 conf] # cd..
[root@server1 nginx] # cd html
[root@server1 html] # vim index.php # write a simple test file
[root@server1 html] # / etc/init.d/httpd start # enable httpd
Starting httpd: [OK]
3. Test 172.25.29.1