Linux under Apache support PHP configuration

Source: Internet
Author: User

This article is used to remember the whole two days of the lamp environment, if the PHP is not required to recommend all with Yum one-click installation, purely personal experience, the main role is for reference.

Yum Install httpd #yum installs Apache.

PHP Compilation Installation

Remember to install PHP dependent environment before installing

Yum installs PHP5.6 's dependent environment

Yum-y install gcc gcc-c++ libxml2 libxml2-devel

PHP5.6.2 Download Path

wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz

/configure--prefix=/usr/local/php \ #PHP安装路径
--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS \ #--with-apxs2 pointing to Apache's APXS path

--with-config-file-path=/usr/local/php/etc #PHP配置文件路径

--ENABLE-FPM--enable-mbstring--enable-gd--enable-xml #加载fpm, mbstring module

--with-mysql=/usr/local/mysql #支持MySQL replaced with the MySQL path.

Make && make install #有需要的PHP拓展的自己编译的时候加上.

Copy the PHP configuration file.

CP Php-5.6.2/php.ini-development/usr/local/php/etc/php.ini

Modify the Apache configuration file httpd.conf

DirectoryIndex index.html index.php #添加index. php

Found it:

AddType application/x-compress. Z

AddType application/x-gzip. gz. tgz

Add the following content

AddType Application/x-httpd-php-source. Phps

AddType application/x-httpd-php. php

Check if LoadModule php5_module modules/libphp5.so has added libphp5.so file exists

Write the test file index.php content as follows, put in Apache's default Web site Directory documentroot #默认路径/var/www/html

<?php

Phpinfo ();

?>

Start the Apache service, if it fails to start, review the configuration file httpd.conf, locate the error log error.log, and modify it for the issue.

Service httpd Restart

With the browser access to the http://IP/, you can see the PHP configuration to indicate that you have succeeded.

Linux under Apache support PHP configuration

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.