Linux under Apache install PHP

Source: Internet
Author: User
Tags install openssl mcrypt

Php

1. Download unzip

Cd/usr/local/srcwget Http://mirrors.sohu.com/php/php-5.6.9.tar.gztar zxvf PHP-5.6.9.TAR.GZCD php-5.6.9

2. Compiling the installation


--with-png-dir--with-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-mcrypt--with-openssl-- Enable-soap--enable-gd-native-ttf--enable-mbstring--enable-sockets--enable-exif--disable-ipv6

Compile to (full) http://blog.csdn.net/godmatrix/article/details/5969558./configure configuration, install--WITH-APR=/USR/LOCAL/APR \  Specify the directory for the APR code--prefix=/usr/local/php \ Specifies the PHP installation directory.--WITH-APXS2=/USR/LOCAL/APACHE2/BIN/APXS allows Apache server to support PHP. The integrated APACHE,APXS function is to use the LoadModule directive in MOD_SO to load the specified module to Apache, which requires Apache to open the so module--with-config-file-path=/usr/local/php/etc Specify the location of the php.ini configuration file--with-mysql=/usr/local/mysql mysql installed directory, support for MySQL--with-libxml-dir open support for LIBXML2 library--WITH-GD Open support for GD libraries--with-jpeg-dir--with-png-dir open support for JPEG pictures and PNG images--with-freetype-dir open support for FreeType font libraries--with-iconv-dir Open the Iconv function library, the conversion between the character set--with-zlib-dir open support for the Zlib library--with-bz2 open support for bz2 files--with-openssl open OpenSSL support, encrypted transmission use-- The With-mcrypt algorithm, Mhash and MCrypt are both extensions of the algorithm--enable-soap open SOAP support--enable-gd-native-ttf support true Type string function library--enable-mbstring Multibyte, string support--enable-sockets Open sockets support for--ENABLE-EXIF picture metadata support--disable-ipv6 not supported IPv6

  

Error 1

Configure:error:xml2-config not found. Please check your LIBXML2 installation. Configuration: Error: Xml2-config is missing. Please check your LIBXML2 installation. Solution: Yum Install libxml2 libxml2-devel-y

  

Error 2

Configure:error:Cannot find OpenSSL ' s <evp.h> configuration: Error: Unable to find OpenSSL < evp.h > Workaround: Yum install OpenSSL Openssl-devel-y

  

Error 3

Configure:error:Please Reinstall the BZIP2 distribution configuration: Error: Reinstall BZIP2 Distribution Solution: Yum Install bzip2 bzip2-devel-y

  

Error 4

Configure:error:jpeglib.h not found. Configuration: Error: Jpeglib. Not found. Solution: Yum Install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel-y

  

Error 5

Configure:error:mcrypt.h not found. Please reinstall Libmcrypt. Configuration: Error: MCrypt. Not found. Please reinstall Libmcrypt. FIX: Install epel-release source Yum install Epel-release-yyum install libmcrypt-devel-y

  

Final execution

Makemake Install

3. Copy the PHP master configuration file

CP Php.ini-production/usr/local/etc/php.ini

  

4. Modify the Apache configuration file so that Apache supports parsing PHP

Vim/usr/local/apache2/conf/httpd.conf
1. Locate #servername www.example.com:80 instead
ServerName www.example.com:80








3. Find

<ifmodule dir_module>



Switch

<ifmodule dir_module>



4. Find


AddType application/x-gzip. gz. tgz

Switch





Note:



4. AddType application/x-httpd-php. PHP Application Type support PHP

  

5. Check the configuration file for errors

/usr/local/apache2/bin/apachectl-t

6. Launch Apache Service

/usr/local/apache2/bin/apachectl start

7. View the process

PS aux |grep httpd

8. Turn off the firewall.

Permanently close SELinux and reboot to take effect.

Vim/etc/selinux/config
Find selinux=enforcing to selinux=disabled temporary shutdown setenforce 0getenforce  View current selinux firewall status Setenforce 0 is temporarily off Setenforce 1 is temporarily open # Enforcing-selinux security policy is enforced. Open # Permissive-selinux prints warnings instead of enforcing. Open does not intercept # disabled-no SELinux policy is loaded. Off, default

  

9. Clear the Iptables rule

Iptables-f Service Iptables Save

10. Browser Access IP

Whether to show it works! The display instructions were successful.

11. Test parsing PHP

Cd/usr/local/apache2/htdocs

PHP master configuration file vim/usr/local/apache2/conf/httpd.conf the path to the specified document root DocumentRoot "/usr/local/apache2/htdocs"

Touch 1.txt   Echo ' qqqqq ' >> 1.txthttp://192.168.1.116/1.txtvim 2.php<?phpphpinfo ();? >http://192.168.1.116/2.php

Save Image 4. remarks PHP installation OK

PHP Installation Successful

PHP installation package: Link: Http://pan.baidu.com/s/1nvbrFJF Password: sy20

Linux under Apache install PHP

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.