Compile and install php in linux

Source: Internet
Author: User
: This article describes how to compile and install php in linux. if you are interested in the PHP Tutorial, refer to it. 1, http://php.net/download the corresponding version of the source code
2. decompress the source code and execute it in the source code directory.

./Configure -- prefix =/usr/php -- with-mysql =/mysql ext directory... -- enable-fpmmake & make install

Prefix indicates the installation directory, and with indicates the extension that is compiled along with the source code.
Enable is to enable fpm. after fpm is enabled, an executable file php-fpm will appear in the php installation directory sbin.

Extended compilation can be added later or compiled together with the source code. the extension source code directory is followed by the = sign. the extended source code can be obtained in two ways, in the PHP source code, the ext directory contains the extended source code, which needs to be downloaded from other places to the source code.

3. Compile the php extension separately
After installing php, the executable file phpize in the php/bin directory is used to generate files such as configure and execute it in the source directory.

/Usr/php/bin/phpize./configure-with-php-config =/usr/php/bin/php-configmake & make install

If an error is reported during compilation, you can use apt-get to install other dependencies,
The php-config file is also an executable php file, which can exist in the php extension directory after completion. so file, and then in php. enable extension in ini and restart php-fpm to load the extension.

4. view the php extension and run the php-m command to view the extensions currently installed in php.
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 Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

The above describes how to compile and install php in linux, including related content, and hope to help those who are interested in PHP tutorials.

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.