Get the App
SLTechnology News&Howtos  ›  Development  › 

How to compile and install PHP

Shulou Source: shulou.com Published: 2022-06-03 04:05:26 09月30日 Update

This article will explain in detail how to compile and install PHP. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

PHP compilation and installation

# cd / usr/local/src

# wget http://cn2.php.net/distributions/php-5.5.26.tar.bz2

# tar jxvf php-5.5.26.tar.bz2

# cd php-5.5.26

#. / configure\

-- prefix=/usr/local/php\ # # specify the installation directory

-- with-apxs2=/usr/local/apache2/bin/apxs\ # automatically installs the "dynamic" extension module

-- with-config-file-path=/usr/local/php/etc\

-- with-mysql=/usr/local/mysql\ # # indicates that php also depends on mysql

# # also explain why you must install mysql or apache before installing php

-- with-libxml-dir\

-- with-gd\

-- with-jpeg-dir\

-- with-png-dir\

-- with-freetype-dir\

-- with-iconv-dir\

-- with-zlib-dir\

-- with-bz2\

-- with-openssl\

-- with-mcrypt\

-- enable-soap\

-- enable-gd-native-ttf\

-- enable-mbstring\

-- enable-sockets\

-- enable-exif\

-- disable-ipv6

# # in the process of compilation and installation, many errors will occur because PHP depends on some packages

# # examples of errors:

# # when "configure:error:jpeglib.h not found" or "configure:error:mcrypt.h.h not found" appears

# # install epel extension Source (yum extension Source) first:

# rpm-ivh 'http://www.lishiming.net/data/p_w_upload/forum/epel-release-6-8_32.noarch.rpm'

# # you can find the corresponding package in the source:

# yum list | grep-I jpeg or yum list | grep-I mcrypt

# # A file named "libjpeg-turbo-devel" or "libmcrypt-devel" corresponding to these two errors

# # install the package

# yum install-y libjpeg-turbo-devel or

# yum install-y libmcrypt-devel

# # recompile and install php after installing the package.

# echo $?

# make

# echo $?

# make install

# echo $?

Common options for ★ PHP

# / usr/local/php/bin/php # # executable file

# / usr/local/php/bin/php-m # # you can see some static modules

# # php also has dynamic modules, which need to be compiled by yourself

# / usr/local/php/bin/php-I # # you can view relevant configurations (version information, etc.)

This is the end of this article on "how to compile and install PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Compile module dynamic article error file more good practical two information content commonly used article version directory knowledge process static reference Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Xiaomi Huawei vpn Shulou Technology