Heim  >  Artikel  >  php教程  >  LAMP之安装php

LAMP之安装php

WBOY
WBOYOriginal
2016-06-06 19:54:20957Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:ubuntu12.04安装php5Nächster Artikel:php 多语言切换