1. Download the source code
$ mkdir /usr/downloads$ wget -c http://cn2.php.net/distributions/php-5.6.20.tar.gz$ tar -xvf php-5.6.20.tar.gz$ mv php-5.6.20 /usr/local/src$ cd !$ & cd php-5.6.20
2. Read the installation Instructions
$ ls -also$ less README$ less INSTALL
3. Installing dependent Packages
$ yum install apr apr-util apr-devel apr-util-devel prce lynx
4. Installing httpd
$ wget -c http://apache.fayea.com//httpd/httpd-2.4.20.tar.gz$ tar -xvf httpd-2.4.20.tar.gz$ cd httpd-2.4.20$ ./configure \--prefix=/usr/local/programs/apache2 \--enable-rewrite \--enable-so \--enable-headers \--enable-expires \--with-mpm=worker \--enable-modules=most \--enable-deflate \--enable-module=shared$ make$ make install$ cd /usr/local/programs/apache2$ cp bin/apachectl /etc/init.d/httpd ## 复制启动脚本$ /etc/init.d/httpd start ## 启动apache服务器,访问http://localhost/$ egrep -v '^[ ]*#|^$' /usr/local/apache2/conf/httpd.conf | nl ## 查看apache服务器的配置## 将apache加入系统服务vi /etc/rc.d/rc.local```/usr/local/programs/apache2/bin/apachectl start```$ cat /etc/rc.local
4. Installing PostgreSQL
$ yum Install Readline-devel # # installs ReadLine dependent $ cd/usr/downloads$ wget-c Https://ftp.postgresql.org/pub/source/v9.5.0/po stgresql-9.5.0.tar.bz2$ tar-xvf postgresql-9.5.0.tar.bz2$ cd postgresql-9.5.0$./configure--prefix=/usr/local/ programs/postgresql$ make$ su$ make install$/sbin/ldconfig/usr/local/programs/postgresql/lib # # Refresh under Shared dynamic library $ cd/usr/ local/programs/postgresql$ bin/psql--version # # check run condition # # Start configuration for PostgreSQL $ vi/etc/profile.d/postgresql.sh # # Add environment variables, It is not recommended to add directly to/etc/profile, the system update upgrade will require the merge "Path=/usr/local/programs/postgresql: $PATHexport PATH" $ source/etc/ Profile # # Update environment variable # # Add users and other folders $ adduser postgres$ passwd postgres $ mkdir/usr/local/programs/postgresql/logs$ mkdir/usr/ local/programs/postgresql/data$ chown postgres/usr/local/programs/postgresql/data$ su-postgres## Initialize the database $./bin/ Initdb-d./data$./bin/createdb test$./bin/psql test## already have a database, you can import the Data folder and try root access, if you have a password, you may need to further study the next $./bin/postgres-d. /data >./logs/start-log-1.log 2>&1 &$./bin/psql--lIST # #列出数据库 # # OK, installation complete # # custom settings, permissions control, etc., can skip, and so familiar with the use of the edit database configuration and Permissions files: $ vi/usr/local/programs/postgresql/data/ POSTGRESQL.CONF # # Database configuration file $ chown postgres postgresql.conf$ chmod 644 postgresql.conf$ Vi/usr/local/programs/postgresql /data/pg_hba.conf # # Permissions file $ vi/usr/local/programs/postgresql/data/pg_ident.conf## set boot from: $ vi/etc/rc.d/rc.local # # Add the following "'/usr/local/programs/postgresql/bin/postgresql start '
5. Install PHP
# # source has been downloaded in the first step, now start installation: $ yum install libxml2 libxml2-devel libpng libpng-devel libjpeg libjpeg-devel freetype Freetype-dev el$./configure \--prefix=/usr/local/programs/php \--with-apxs2=/usr/local/programs/apache2/bin/apxs \--with-zlib \ --WITH-GD \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--with-zlib-dir \--enable-mbstring \--with-pgsql=/ Usr/local/programs/postgresql \--with-pdo-pgsql=/usr/local/programs/postgresql $ make$ make test> Bug #42718 ( Unsafe_raw filter not applied when configured as default filter) [EXT/FILTER/TESTS/BUG42718.PHPT] Xfail Reason:filter_un Safe_raw not applied if configured as default filter, even with flags> Bug #67296 (filter_input doesn ' t validate vari Ables) [Ext/filter/tests/bug49184.phpt] xfail reason:see bug #49184 > Bug #53640 (XBM images require width to be multi Ple of 8) [EXT/GD/TESTS/BUG53640.PHPT] Xfail reason:padding is not implemented yet> Zend multibyte (7) [ext/mbstring/ TESTS/ZEND_MULTIBYTE-07.PHPT] Xfail Reason:httPs://bugs.php.net/bug.php?id=66582> Zend Multibyte (9) [EXT/MBSTRING/TESTS/ZEND_MULTIBYTE-09.PHPT] XFAIL REASON: Https://bugs.php.net/bug.php?id=66582>Bug #70470 (built-in server truncates headers spanning over TCP packets) [sapi/ CLI/TESTS/BUG70470.PHPT] Xfail reason:bug is not fixed yet## check the official bug, found:> id=66582:status:closed. Fixed in Master (PHP7) > Id=42718:status:assigned> id=42718:reference to id=49184, unsolved for many years## that's not off. Mind, just load it. $ make install> want to add:/usr/local/programs/php/lib/php to your php.ini include_path## then just press it to set it up. $ c P Php.ini-development/usr/local/programs/php/lib/php.ini ' include_path = '.; usr/local/programs/php/lib/php "# # Then, edit the settings of the httpd to make sure it correctly parses the php file ' ... LoadModule php5_module modules/libphp5.so ... AddType application/x-httpd-php. Phpaddtype application/x-httpd-php-source. PhP5 ...
directoryindex index.html index.php
"# # Restart HTTPD, test $ cd/usr/local/programs/apache2$ bin/httpd-h$ bin/httpd-k stop$ bin/httpd-f conf/httpd.conf## default setting of www The page is under./htdocs/, so go ahead and build a test page. $ VI htdocs/index.php "
"' $ curl http://localhost/index.php |grep Postgresql#ok
What should be done in the future
* 1. When booting, you do not need to specify the configuration file manually
* 2. PHP Initialization www directory settings
* 3. PHP User, rights management, etc.
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the CentOS 7 under the source code compiled to install PHP support PostgreSQL, including the Postgresql,centos 7 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.