Turn: Second step CentOS install lamp PHP environment and installation process error solution (pure system environment)

Source: Internet
Author: User

Configure the AMP environment on the CentOS system recently and configure it to the PHP environment now

Don't say a word on the Portal: http://blog.csdn.net/zhangatle/article/details/77447653

Some of these changes, after all, the blogger's CentOS system does not have to install the necessary development environment package, he is pure CentOS installation! Admire

Note: This article stands in the Novice's perspective and solve the problem, the middle will inevitably encounter many pits, and the purpose of this article is to help you solve these pits

工欲善其事, its prerequisite, for follow-up work, the following preparations are required first
Upload the required software installation package to the server, upload this article to the/home/zhangatle/tar directory, including the following software:

Zlib-1.2.11.tar.gz
Libxml2-2.7.2.tar.gz
Jpegsrc.v9b.tar.gz
Libpng-1.4.3.tar.gz
Freetype-2.8.tar.gz
Libgd-2.2.4.tar.gz
Php-7.1.8.tar.gz

Next installation work, note that the installation of these software is in order, in order to avoid unnecessary errors, can be installed in the following order

1, the installation of zlib

cd/home/zhangatle/Tartar zxvf zlib-1.2.  One . TAR.GZCD zlib-1.2.  One  . /configure    // This configuration compile command do not add directory parameter make && make install

2, LIBXML2 installation

cd/home/zhangatle/Tartar zxvf libxml2-2.7. 2 . tar.gz CD libxml2-2.7. 2 . /configure--prefix=/usr/local/libxml2  --without-&& make install

3. Install JPEG

cd/home/zhangatle/zxvf jpegsrc.v9b.tar.gzcd jpegsrc.v9b. /configure--prefix=/usr/local/--enable-shared--enable-static&& make install

–enable-shared the function library program that the JPEG needs to compile into the software inside
Advantages: fast function call speed
Cons: The software itself is larger
–enable-static static mode (standalone type) function processing, what function is required, immediate include to
Advantages: The software itself is relatively small
Cons: Slow function calls

4, installation libpng

cd/home/zhangatle/Tartar zxvf libpng-1.4. 3 . tar.gz CD libpng-1.4. 3  . /Configure  && make install

5. Install FreeType (font library)

cd/home/zhangatle/Tartar zxvf freetype-2.8. tar.gz cd FreeType-2.8. /configure--prefix=/usr/local/&& make install

6. Install GD Library

cd/home/zhangatle/Tartar zvxf GD-2.2. 4 . tar.gz CD GD-2.2. 4 . /configure--prefix=/usr/local/gd              --with-jpeg=/usr/local/jpeg/                --with-png--with- zlib              --with-freetype=/usr/local/freetype            // Surprise, finally error, Huadu thanks

No, I've already installed libpng, why do I get an error? Then we begin to fix the error:
After finding the relevant information, is missing libpng-devel, not much said, installation

Yum Install Libpng-devel

Installation complete, return to the superior directory, and remove the LIBGD after decompression, repeat the above LIBGD installation steps

Cd.. /-RF gd-2.2. 4

Sure enough, either do not report, or the error one by one, and a mistake occurred

Find relevant information, find a solution, install Fontconfig-devel

Yum Install Fontconfig-devel

Then go back to remove the unpacked package, re-unzip, and then repeat the above LIBGD installation steps
This time found the following command finally did not error, meaning not unexpectedly?

cd/home/zhangatle/-zvxf gd-2.2. 4 . tar.gz CD GD-2.2. 4 . /configure--prefix=/usr/local/gd              --with-jpeg=/usr/local/jpeg/                --with-png--with- zlib              --with-freetype=/usr/local/freetype

Then Make&&make install, the success, expect the installation of PHP has been completed, the following to install PHP

7, Installation PHP7

Execute the following command, more parameters, note the path, avoid errors

cd/home/zhangatle/Tartar-JXVF php-7.1.8. TAR.GZCD php-7.1.8./configure--prefix=/usr/local/PHP--with-apxs2=/usr/local/httpd/bin/Apxs--with-mysql=Mysqlnd--with-pdo-mysql=Mysqlnd--with-mysqli=Mysqlnd--with-freetype-dir=/usr/local/FreeType--with-gd=/usr/local/GD--with-zlib--with-libxml-dir=/usr/local/LIBXML2--with-jpeg-dir=/usr/local/JPEG--with-png-dir--enable-mbstring= All--enable-Mbregex--enable-shared//at this point there will be a warning, tell us the MySQL problem, do not control, because we have not installed MySQL, and then make&&make install

Make

Go to dinner first, installation takes a long time, haha
Back a look, TMD, and error, can you play happily? Another fatal mistake.

Looked for a long time of information, finally found the problem, the lack of libxpm, then install it

Yum Install libxpm-devel.x86_64

Once the installation is complete, reinstall the GD library again to show that the XPM installation is complete to install PHP again

Install PHP again, gram, to error, endless

Problem Description: The installation location of the XPM library was not found
Workaround:
1.RPM-QL libxpm: Check out the installation location of libxpm, found under/usr/lib64/
2. Add –with-xpm-dir=/usr/lib64/in Recompile php,./configure

Finally the installation is successful, then the related configuration work

First, copy a configuration file to the project's installation directory

CP php.ini-development    /usr/local/php/lib/php.ini

Configure Apache to support PHP
Vi/usr/local/httpd/conf/httpd.conf
1) in httpd.conf (Apache Master config file), add:

AddType application/x-httpd-php. php    

2) Find the following paragraph: (in the file input/Slash and then enter the content to search press ENTER to search for content)

<ifmodule dir_module>    directoryindex index.html</IfModule>

Add index.php in front of index.html

3) Build PHP test page

VI is the meaning of creating a file

Enter the following content:

<? php echo phpinfo ();? >

4) Restart Apache

/usr/local/httpd/bin/apachectl restart

Here is a small mistake, according to the tip, it is servername problem, change it just fine

Find the ServerName in the httpd.conf and remove the previous # number, so that the installation of PHP has been successful

after the word, sleep a nap, welcome to correct mistakes, promote each other

Turn from: @zhangatle

Turn: Second step CentOS install lamp PHP environment and installation process error solution (pure system environment)

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.