Home php教程 php手册 Linux 安装 php

Linux 安装 php

Jun 06, 2016 pm 07:53 PM
linux php Install Version

Linux 版本 : Redhat6.2 php版本 : php-5.4.1 之前写过: Linux Apache 安装 Linux 安装 php-5.4.1 1. 下 载 php-5.4.1.tar.gz 2. 解压 [root@test31~] tar -zxvf php-5.4.1.tar.gz 3. 进入安装文件目录 [root@test31~] cd php-5.4.1 4. 执行 [root@test31

Linux 版本: Redhat6.2

php版本   php-5.4.1

之前写过: Linux Apache 安装

Linux 安装 php-5.4.1

1. 下载 php-5.4.1.tar.gz

2. 解压

[root@test31~] tar -zxvf php-5.4.1.tar.gz

3. 进入安装文件目录

[root@test31~] cd php-5.4.1

4. 执行

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs--with-mysql

注意:绿色标记为你 apache的安装目录

出现问题:

"configure: error: xml2-config not found.Please check your libxml2 installation."

检查是否安装了libxm包

[root@test31 php-5.4.1]# rpm -qa |grep libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

安装完之后查找xml2-config文件是否存在

[root@test31 php-5.4.1]#  find / -name"xml2-config"
/usr/bin/xml2-config

如果存在的话重新安装php

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs--with-mysql

执行如果报错:  Cannot find MySQL header files under yes

需要指定mysql的安装路径

[root@test31 php-5.4.1]# ./configure --prefix=/usr/local/php5--with-apxs2=/usr/local/web/apache/bin/apxs --with-mysql=/usr/local/mysql

安装成功的标志是:

出现

+--------------------------------------------------------------------+
|License:                                                          |
| This software is subject to the PHP License, available inthis    |
| distribution in the file LICENSE.  By continuingthis installation |
| process, you are bound by the terms of this licenseagreement.    |
| If you do not agree with the terms of this license, you mustabort |
| the installation process at thispoint.                           |
+--------------------------------------------------------------------+

Thank you for using PHP.

 5.然后执行

[root@test31 php-5.4.1]# make

[root@test31 php-5.4.1]# make install

6. 配置 php.ini

<span>[root@test31 php-5.4.1]# cp php.ini-development /usr/local/lib/php.ini</span>
Copy after login

7. 编辑 httpd.conf 文件以调用 PHP 模块。LoadModule 表达式右边的路径必须指向 系统中的 PHP。以上的make install 命令可能已经完成了这些,但务必要检查。

[root@test31 php-5.4.1]# vi/usr/local/web/apache/conf/httpd.conf

<span>LoadModule php5_module modules/libphp5.so</span>
Copy after login

再加入一行让apache正确处理apache文件

AddType application/x-httpd-php.php

再找到 DirectoryIndex关键字:添加 index.php

开启.httaccess功能

AllowOverrideAll

保存对httpd.conf的修改。

8. 查看是否安装成功

在apache的htdocs目录下建立文件phpinfo.php 输入代码

phpinfo();

?>

保存,并启动apache。

[root@test31 bin]#./apachectl start

9.打开网址: http://192.168.2.9/phpinfo.php

出现php相关的信息,说明php-5.4.1 安装成功了! 

参考 php 官方文档: http://www.php.net/manual/zh/install.unix.apache2.php

Statement of this Website
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

Four ways to implement multithreading in C language Four ways to implement multithreading in C language Apr 03, 2025 pm 03:00 PM

Multithreading in the language can greatly improve program efficiency. There are four main ways to implement multithreading in C language: Create independent processes: Create multiple independently running processes, each process has its own memory space. Pseudo-multithreading: Create multiple execution streams in a process that share the same memory space and execute alternately. Multi-threaded library: Use multi-threaded libraries such as pthreads to create and manage threads, providing rich thread operation functions. Coroutine: A lightweight multi-threaded implementation that divides tasks into small subtasks and executes them in turn.

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

Explain the match expression (PHP 8 ) and how it differs from switch. Explain the match expression (PHP 8 ) and how it differs from switch. Apr 06, 2025 am 12:03 AM

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

How to open web.xml How to open web.xml Apr 03, 2025 am 06:51 AM

To open a web.xml file, you can use the following methods: Use a text editor (such as Notepad or TextEdit) to edit commands using an integrated development environment (such as Eclipse or NetBeans) (Windows: notepad web.xml; Mac/Linux: open -a TextEdit web.xml)

See all articles