CENTOS7 Compiling and installing PHP

Source: Internet
Author: User

VM installs PHP, the system is centos7,php version 5.6.15.
First unzip, enter the source directory:

Compile the configuration for the source code:

Configuration parameters:

./configure--Prefix=/usr/Local/php--Enable-FPM -- with-curl -- with-openssl --Enable-mbregex -- with-mysql -- with-mysqli -- with-mysql-sock --Enable-pdo -- with-pdo-mysql --Enable-mysqlnd -- with-GD -- with-zlib --Enable-zip -- with-bz2 --Enable-xmlreader --Enable-xmlwriter --Enable-mbstring -- with-xmlrpc -- with-libxml-dir=/usr--Enable-soap  --Enable-sockets --Enable-pcntl --Enable-exif --Enable-bcmath -- with-mhash --Enable-ftp --Enable-opcache --Disable-fileinfo -- with-APXS2=/usr/Local/apache2/bin/apxs-- with-pear
部份参数说明:--with-apxs2=/usr/local/apache2/bin/apxs        使php做为apache的一个模块来进行编译,与apache的--enable-so参数相合,此目录为你安装apache的目录;--with-curl     打开curl浏览工具的支持;--enable-fpm    CGI方式安装的启动程序;--with-openssl      打开openssl支持,加密传输https时能用到       --enable-bcmath     打开图片大小调整,用到zabbix监控的时候用到了这个模块--with-mhash        mhash算法扩展--enable-sockets        打开 sockets 支持   --enable-exif   打开图片的元数据支持 --enable-ftp    启用ftp支持 --enable-mbstring       启用多字节字符串支持--with-pear     打开pear命令的支持

Start configure, an error occurred:

Look at the description of the error, the system is missing Libxml library, using Yum to install:

Continue to configure after the installation is complete, or an error occurred:

Look at the error message description, is the system missing bzip2, OK, continue to install:

Break through the hardships, continue to configure, continue to see the error:

The error message indicates that the Libcurl library is missing from the system, and the installation:

Continue with the configuration and continue with the wrong journey:

Look at these error messages, the library is missing jpeg/png and so on, continue to install: (

After the library installation is complete, continue./configure, OK, this time finally no more errors, tears Ah 5555 ...

OK, you can start the make and made install:)

Make &&make install takes about a few minutes, this looks at the configuration of the machine.

Look at the compiled PHP module in the Apache directory:

See compiled libphp5.so module, edit Apache configuration file httpd.conf, gee, I actually added to the configuration file, easy:)

Do a test to see how Apache and PHP are installed:

Edit a file, output the most classic phpinfo ();

Gee, in the browser input ip/a.php, found not find the server, what happened??
Oh, remember, maybe the firewall didn't turn off.

Turn off the firewall and try again, this time the message, but not the expected information, Apache server did not parse PHP, but the code as text to the original output, why??

Recall the operation of the steps, um, Apache configuration file is still a problem, continue to modify httpd.conf, in its last add a line:

Let Apache know to parse the PHP file and then look at it in a browser:

Finally came out of this familiar interface, haha, done, can sleep:)

CENTOS7 Compiling and installing PHP

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.