search
HomeBackend DevelopmentPHP ProblemLinux php installation and configuration method

How to install and configure Linux PHP: first obtain the support files needed to install PHP; then install libxml2; then install PHP5 through "make install"; and finally reconfigure apache2 to support PHP.

Linux php installation and configuration method

Recommended: "PHP Video Tutorial"

The operating environment of this tutorial: linux5.9.8 system, PHP5.3.8 version, this method is applicable to all brands of computers.

The example in this article describes how to install and configure the PHP environment on Linux. Share it with everyone for your reference, the details are as follows:

1. Get the installation file: http://www.php.net/downloads.php php-5.3.8.tar.gz

Get the support files needed to install php: http://download.csdn.net/download/netlong339/1351852 libxml2-2.6.32.tar.gz

2. Installation libxml2

The code is as follows:

tar zxvf libxml2-2.6.32.tar.gz
cd libxml2-2.6.32
./configure --prefix=/usr/local/libxml2
make
make install

If the installation is successful, bin, include, lib, man and share will be generated in the /usr/local/libxml2/ directory directory. When installing the configuration of the PHP5 source code package later, the "--with-libxml-dir=/usr/local/libxml2" option will be added to the options of the configure command to specify the location where the libxml2 library file is installed.

3. Install php5

The code is as follows:

#tar zvxf php-5.3.8.tar.gz
#cd php-5.3.8
#./configure \
--prefix=/usr/local/php \
--with-mysql=/usr/local/mysql \
--with-apxs=/usr/local/apache2/bin/apxs \
--enable-fastcgi \
--enable-fpm
#make
#make install

4.Reconfigure apache2 to support php

① Configure httpd.conf to let apache support PHP:

The code is as follows:

# vi /usr/local/apache/conf/httpd.conf

Find AddType application/x-gzip .gz .tgz and add it under it The following content

AddType application/x-httpd-php .php (.前面有空格)
AddType application/x-httpd-php-source .phps (.前面有空格)

② Then the CPOPY PHP configuration file

code is as follows:

cp php-5.3.8/php.ini.dist /usr/local/php/lib/php.ini

(If there is no php.ini.dist, put php.ini-development Just rename any one in php.ini-production to php.ini.dist.)

Modify the php.ini file

The code is as follows:

register_globals = On

③ Restart apache

The code is as follows:

service apache restart

5. Test whether php is successfully installed

Write a php test page info.php and put it in in apache2/htdocs.

<?php
 phpinfo();
?>

Enter in the browser: server address/info.php

If the php information can be displayed normally, it means that Apche Mysql PHP is installed successfully!

The above is the detailed content of Linux php installation and configuration method. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.