Source Installation PHP7

Source: Internet
Author: User
Tags php source code zts
This article mainly introduces the source code installation PHP7, has a certain reference value, now share to everyone, the need for friends can refer to

Source Installation PHP7

First, download PHP source package

    • Click Download to download the latest version of PHP

Second, compile and install

    1. Extract

      • tar -vjxf php-7.2.5.tar.bz2

    2. Configure

      • ./configure --prefix=yourpath

      • You may need to install:

      • yum install gcc

      • yum install libxml2-devel

    3. Make

    4. Make install

    5. Execution yourpath/bin/php -m , if you can see the extension of PHP, indicating that the installation was successful

Iii. Simplifying PHP execution commands

    • vim ~/bash_profile

    • Add a line:alias php=yourpath/bin/php

    • source ~/bash_profile

Iv. Some of the pits that may be encountered

    1. Installing PHP requires you to install GCC and AutoConfig

    2. Copy the php.ini-development of the source directory to Yourpath/etc

    3. and renamed Php.ini-development to PHP.ini.

    4. php -i | grep php.ini, you can see that php.ini is placed by default in the Yourpath/lib directory

    5. So put the php.ini under the Yourpath/lib.

Five, through the phpize for PHP to do not recompile PHP installation of OpenSSL

    • PHP Source code path:/opt/download/php-7.2.5

    • Installation path:/opt/soft/php

    • PHP.ini Path:/opt/soft/php/lib

  1. Enter the extended directory for OpenSSL

      • cd /opt/download/php-7.2.5/ext/openssl

  2. Run Phpize

      • /opt/soft/php/bin/phpize

  3. If cannot find CONFIG.M4 error occurs, the

      • cp config0.m4 config.m4

  4. Performing the installation

      • ./configure --with-openssl --with-php-config=/usr/local/php7/bin/php-config

      • make && make install

  5. After the installation is complete, you will be prompted to generate the. So file in a directory where my build location is

      • /opt/soft/php/lib/php/extensions/no-debug-non-zts-20170718/

  6. Open PHP.ini, add the following two lines

      • extension_dir = "/opt/soft/php/lib/php/extensions/no-debug-non-zts-20170718/"


  7. Restart PHP to

Vi. Installation of composer

    1. Download the Composer.phar to the project

      • curl -sS | php

    2. If the Composer.phar is placed in the PATH directory of the system, it can be accessed globally Composer.phar

      • mv composer.phar /usr/local/bin/composer

Related recommendations:

Redis Source Code parsing

Related Article

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: 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.