Home > php教程 > php手册 > body text

LAMP之安装php

WBOY
Release: 2016-06-06 19:54:20
Original
954 people have browsed it

1、查看之前是否安装php $rpm -qa | grep php 2、如果安装过,先删除, $rpm -e php --nodeps 3、解压 $tar -zxvf php-5.2.5.tar.gz $cd php-5.2.5之后 对php源码包进行编译: $./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache /bin/ap

1、查看之前是否安装php
$rpm -qa | grep php
2、如果安装过,先删除,
$rpm -e php --nodeps
3、解压
$tar -zxvf php-5.2.5.tar.gz


 

$cd php-5.2.5之后
对php源码包进行编译:
$./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache
/bin/apxs --with-mysql=/usr/local/mysql
$make生成可以执行的文件
$make install安装

Tips:php如果安装成功,会在apache/modules下生成libphp5.so

打开apache配置文件,(/usr/local/apache/conf/http.conf)在最后加入一行
AddType application/x-httpd-php .php

重启apache
$/usr/local/apache/bin/apachectl restart

创建php文件,(/usr/local/apache/htdocs)名叫test.php输入以下内容

  echo phpinfo();
?>

打开浏览器测试:输入:http://localhost/test.php


最后,php-5.2.5目录中的php.ini-dist
cp php.ini-dist /usr/local/php/lib/php.ini

Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!