Linux compile and install php

WBOY
Release: 2016-07-30 13:30:35
Original
1219 people have browsed it

1. http://php.net/ Download the source code of the corresponding version
2. After decompressing the source code, execute in the source code directory

<code>./configure --prefix=/usr/php
--with-mysql=/mysql ext目录
<span>...</span>
--enable-fpm

make && make install</code>
Copy after login

prefix is ​​to specify the installation directory, and with is to specify the extension to be compiled together with the source code
enable is to enable fpm. After enabling fpm, there will be an executable file php-fpm in the php installation directory sbin. The compilation of the extension can be added later or compiled together with the source code. After the = sign is the extended source code directory. The extended source code is There are two ways to obtain it. There is extended source code in the ext directory in the PHP source code. If not, you need to download the source code from other places.

3. Compile php extension separately

After installing php, there is phpize in the php/bin directory. This executable file is used to generate configure and other files. Execute it in the source code directory

<code>/usr/php/bin/phpize
<span>.</span>/configure <span>-with</span><span>-php</span><span>-config</span><span>=</span>/usr/php/bin/php<span>-config</span>
make <span>&&</span> make install</code>
Copy after login

If an error is reported during compilation, other dependencies are needed and can be installed with apt-get. , Among them, php-config is also a php executable file. After completion, the .so file can exist in the php extension directory, then enable the extension in php.ini, and restart php-fpm to load this extension.


4. View php extensions. You can execute the php -m command to view the currently installed php extensions

The directory where php.ini is located can be viewed in phpinfo(). If php.ini does not exist, you can copy php.ini.development from the php source code and rename it.


Copyright Statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

The above introduces Linux compilation and installation of PHP, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!