Install Apache + PHP + MySQL with CentOS source code

Source: Internet
Author: User
Tags openldap fully qualified domain name
Plugin. configure -- prefixusrlocalapache2 -- enable-so -- enable-threads -- with-mpm

Install Apache2.2.17 with CentOS source code

# Install the required library yum-y install zlib-develCp/Home/root/Httpd-2.2.17.tar.gz/usr/local/srcCd/Usr/local/srctar xzvf httpd-2.2.17.tar.gz./configure -- prefix =/usr/local/apache2 --Enable-So -- enable-threads -- with-mpm = worker -- enable-cache -- enable-reWrite= SharEd-Enable-deflate = shared -- enable-ExPires = sharedmakemake install
# Start apache/usr/local/apache2/bin/ApachectlStart # If notice such as httpd: cocould not reliably dete appearsRmIne the server's fully qualified domain name, using 127.0.0.1 for ServerNamevi/usr/local/apache2/conf/httpd. conf: Modify ServerName: ServerName localhost: 80/usr/local/apache2/bin/apachectl restart
 
# InstallationPHP

# Install the required Library first
Yum-y install libxml2
Yum-y install libxml2-devel
Yum-y install gd
Yum-y install gd-devel
Yum-y install curl-devel
Yum-y install libjpeg-devel libpng-devel
Yum-y installFreeType freetype-devel
Yum-y install openldap
Yum-y install openldap-devel
cp /home/root/php-5.2.17.tar.gz /usr/local/src
cd /usr/local/src
tar xzvf php-5.2.17.tar.gz
./configure --prefix=/usr/local/php5 \
--with-suns.com/category/mysql" target=_blank>mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-libxml-dir=/usr/local/lib \
--with-gd \
--with-jpeg-dir=/usr/local/jpeg6 \
--with-zlib \
--with-curl \
--with-ldap \
--with-gettext \
--with-iconv \
--enable-mbstring \
--enable-soap \
--with-png-dir=/usr/local/libpng2 \
--with-freetype-dir=/usr/local/freetype \
--with-xmlrpc \
--with-config-file-path=/usr/local/php5/etc
make
make install
cp /usr/local/src/php.ini-dist /usr/local/php5/etc/php.ini
 
Configuration
 
Vi/usr/local/apache2/conf/httpd. conf
# Add index. php after DirectoryIndex index.html
DirectoryIndex index.html index. php
#
  
   
DuAdd the following to le mime_module>:
   
A DdType application/x-httpd-php. php. phtml
AddType application/x-httpd-php-source. phps
/Usr/local/apache2/bin/apachectl restart
# If an error occurs, such as/usr/local/apache2/modules/libphp5.so: cannotRestoreSegment prot after reloc: Permission denied
# Solution:
SetEnforce 0
Chcon-c-v-R-u system_u-r object_r-t textrel_shlib_t/usr/local/apache2/modules/libphp5.so
/Usr/local/apache2/bin/apachectl restart
Setenforce 1
/Usr/local/apache2/bin/apachectl restart
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: 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.