Linux notes: install apache and php

Source: Internet
Author: User
Linux notes: install apache and php-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Recently there was a testing machine that planned to install a server environment for local testing. The thought is that after the download is back, the installation instructions can be installed, but it is not as easy as you think. After the ftp software is installed, you have never known how to upload and configure it. mysql has been installed, there is no way to start it. I don't know what the problem is.

Fortunately, apache has been installed, and php can be OK today. Note:

Alibaba Cloud's system is Red Hat Linux release 9 (Shrike)

First, download the file. It is easy to download it from the official website:
I downloaded httpd-2.2.6.tar.gz and php-5.2.0.tar.gz
The .tar.gz file is a gunzip compressed file packed with tar. In this case, extract tar-zxvf *** .tar.gz.
Decompress the package to the current folder.
./Configure-> make install

Generally, this step completes the installation of a software, but some parameters need to be adjusted in detail.

Install apache first:

$./Configure -- prefix =/usr/local/apache2
$ Make
$ Make install
$/Usr/local/apache2/bin/apachectl start

Apache2 is installed in the/usr/local/apache2 directory and started. If an error occurs during this process, you need to adjust it.
After successful installation, you can configure the apache documentation path
DocumentRoot "/var/www/"
Restart apache.

A Quan's machine was randomly configured and found that the first step was wrong.
After reading the prompt, it seems that compilation is not possible.
So it seems that the compilation environment has not been installed, and the environment is too sweaty. You can find it in the deletion and adding program:
Add development tools and kernel development software packages.

Apache2 is still smooth, making it difficult to install php.
The configure step prompts me to require a later version of libxml2-2.6 or above
We recommend that you find the missing file on this website:

When I installed libxml, I was prompted that I needed a autoconf-2.60, so I went
Fortunately, they can all be found, or I won't play anymore, haha

Install autoconf and libxml to compile php.
After compilation is completed, INSTALL in the php document.
Who knows that an error occurred while loading the php5 module during startup:

An error occurred while referencing undefined symbol: _ zend_list_delete.

An error occurred while performing operations. It's really depressing. cainiao is like this, but you can still ask for help on the Internet:

When you reference many friends to install apache and make it support php, you may encounter the undefined symbol: _ zend_list_delete error.

After apache and php are installed, the apache configuration file httpd. conf contains statements for starting the php module.

LoadModule php5_module modules/ cannot find the library related to the zend_list function during runtime. I checked some solutions from a foreign website. My own method is: Add -- libdir =/usr/lib to configure when installing php, for example:

./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-pear -- with-mysql =/usr/local/mysql -- libdir =/usr/lib

Try it and find that there is still an error. This article says there are other methods. I have read it. It may be because it was not cleared during compilation:

Reference there may be some problem with the path to libc and other libs on your system.
Per default php5 s configure script uses/usr/local/lib.
You might want to add some -- libdir =/usr/lib to your./configure
./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-pear -- with-mcrypt -- with-mysql -- libdir =/usr/lib

To be sure it uses the new path do some
Make clean
Make distclean
Before recompiling.

Run these two commands to clean up:
Make clean
Make distclean

Then re-compile, so PHP5 is OK.
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.