PHP开发环境的配置(Linux平台上安装Apache和PHP)
PHP开发环境的配置(Linux平台上安装Apache和PHP)
PHP开发环境的配置(Linux平台上安装Apache和php):
下载Apache (httpd-2.4.12.tar.gz)、下载PHP(php-5.6.9.tar.gz)、下载与PHP安装相关的libxml2(libxml2-2.7.8.tar.gz)、下载与Apache安装相关的三个文件:apr(apr-1.5.2.tar.gz)、apr-util(apr-util-1.5.4.tar.gz)、pcre (pcre-8.10.zip)
(1)安装Apache:在安装apache之前必须先安装apr、apr-util和pcre,否则会出错:
安装apr:
Gunzip apr-1.5.2.tar.gz
Tar xvf apr-1.5.2.tar
进入apr-1.5.2目录,然后执行:
./configure --prefix=/usr/local/apr
Make && make install
安装apr-util:
解压后进入apr-util目录,然后执行:
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
Make && make install
安装pcre:在安装之前,必须先安装gcc,否则无法编译pcre文件
安装gcc:yum -y install gcc+ gcc-c++
然后安装pcre:
解压后进入pcre目录,然后执行:
./configure --prefix=/usr/local/pcre
Make && make install
安装好这几个文件后,可以安装apache了,解压httpd-2.4.12.tar.gz:
Gunzip httpd-2.4.12.tar.gz
Tar xvf httpd-2.4.12.tar
进入解压目录:cd httpd-2.4.12,然后执行:
./configure --prefix=/usr/local/apache --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre
Make && make install
(2)安装PHP:
安装php之前先安装libxml2:
解压后进入目录:libxml2-2.7.8,然后执行:
./configure --prefix=/usr/local/libxml2
Make && make install
安装php:解压后进入目录php-5.6.9,然后执行:
./configure --prefix=/usr/local/php --with-libxml-dir=/usr/local/libxml2 --with-apxs2=/usr/local/apache/bin/apxs
Make && make install
安装好php之后,将解压后的php-5.6.9目录里的php.ini-development复制到下面目录:
cp php.ini-development /usr/local/php/lib/php.ini
(3)配置Apache的conf文件夹里面的httpd-conf,添加下面内容(如果不存在的话):
LoadModule处添加LoadModule php5_module module/libphp5.so
在AddTypeapplication处添加AddType application/x-httpd-php .php
(4)启动或者重启Apache:
/usr/local/apache/bin/apachectl restart (或者start)
(5)测试Apache和PHP安装是否正确:
进入Apache里面的htdocs目录下面,
[root@Masterpc htdocs]# vim hello.php
echo "Hello world!";
phpinfo();
?>
在浏览器输入:http://172.16.2.42/hello.php (本人linux主机的ip地址是 172.16.2.42,通过远程访问),访问成功则显示如下:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Windows Recovery Environment (WinRE) is an environment used to repair Windows operating system errors. After entering WinRE, you can perform system restore, factory reset, uninstall updates, etc. If you are unable to boot into WinRE, this article will guide you through fixes to resolve the issue. Unable to boot into the Windows Recovery Environment If you cannot boot into the Windows Recovery Environment, use the fixes provided below: Check the status of the Windows Recovery Environment Use other methods to enter the Windows Recovery Environment Did you accidentally delete the Windows Recovery Partition? Perform an in-place upgrade or clean installation of Windows below, we have explained all these fixes in detail. 1] Check Wi

Shopping platforms that support WeChat payment include: 1. JD.com, a comprehensive online retailer in China; 2. Vipshop, an Internet company that sells branded discounted goods online; 3. Pinduoduo, a leader in new social e-commerce. A shopping platform that better understands consumers; 4. Jingxi, a lifestyle shopping mall under JD.com; 5. Mogujie, an e-commerce website; 6. Jumei Youpin, a fashion shopping website mainly selling cosmetics; 7. , Weidian is a cloud promotion e-commerce platform; 8. Kaola Overseas Shopping is a membership e-commerce platform focusing on cross-border overseas shopping business.

In this article, we will learn about the differences between Python and Anaconda. What is Python? Python is an open source language that places great emphasis on making the code easy to read and understand by indenting lines and providing whitespace. Python's flexibility and ease of use make it ideal for a variety of applications, including but not limited to scientific computing, artificial intelligence, and data science, as well as creating and developing online applications. When Python is tested, it is immediately translated into machine language because it is an interpreted language. Some languages, such as C++, require compilation to be understood. Proficiency in Python is an important advantage because it is very easy to understand, develop, execute and read. This makes Python

With the advancement of communication technology, telephone contact has become more and more common in our daily lives. However, sometimes we may try to call a number only to find that the number is no longer reachable. In order to save time and energy, many people start looking for empty number verification services to confirm the validity of the number. This service can help users quickly check whether a number is valid and avoid unnecessary trouble. 1. What are the empty account detection platforms? Users can check the status of the number, including whether it is empty, by dialing the corresponding inquiry number or visiting the official website through the official inquiry service provided by the operator. This service is provided by many operators to facilitate users to quickly understand the usage of the number. Online empty number detection platforms are now emerging in an endless stream on the market. These platforms provide quick and convenient

Where can I buy Optimism coins? Optimism Coin can be purchased on a number of cryptocurrency exchanges, including: Binance Huobi OKX Matcha Gate.io Kraken Bittrex Poloniex Coinbase Pro Gemini You will need to register an account with these exchanges and complete identity verification before you can purchase Optimism Coin. The steps to purchase Optimism coins are as follows: Choose a safe and reliable exchange. Register an account and complete identity verification. Fund your account. On the trading interface of the trading platform, find the trading pair of Optimism currency, such as OP/USDT. Enter the amount of Optimism coins you want to purchase and click

tme, the full name of "TME Music Cloud Atlas", is a digital distribution platform under Tencent Music Entertainment Group. It is a professional data platform officially announced by Tencent Music Entertainment Group (TME) for cooperative music labels to provide data BI services to industry partners. The TME platform can not only help music labels gain insight into the online real-time data performance of songs and albums under copyright ownership, but also help content producers quickly grasp trends in the music market and listener preferences.

Where can I buy EC coins? On which platform are EC coins traded? Text: EC coin (Ethereum Classic, abbreviation: ETC) is an open source, decentralized blockchain platform and the first hard fork currency of Ethereum. EC Coin has a similar technical foundation to Ethereum, but there are also some key differences. For example, EC Coin has a shorter block time and does not use the Proof of Stake (PoS) consensus mechanism. EC coins can be purchased on many cryptocurrency trading platforms, including: Centralized exchanges: Binance, Huobi, OKX, Matcha, Gate.io, Kraken, Bittrex, Poloniex, etc. Decentralized exchanges: PancakeSwap, Uniswap, Su

PHP integrated environment packages include: 1. PhpStorm, a powerful PHP integrated environment; 2. Eclipse, an open source integrated development environment; 3. Visual Studio Code, a lightweight open source code editor; 4. Sublime Text, a A popular text editor, widely used in various programming languages; 5. NetBeans, an integrated development environment developed by the Apache Software Foundation; 6. Zend Studio, an integrated development environment designed for PHP developers.
