Linux 下安装PHP

先安装libxml
# tar -zxf libxml2-2.6.16.tar.gz
# cd libxml2-2.6.16
# ./configure (xml默认安装就可以,不要指定路径了,因为安装时php可能找不到它,PHP5只支持libxml2-2.5.10以上版本)
# make
# make install

 

PHP v5.0.3 For Linux
  PHP是一种新型的CGI程序编写语言,易学易用,运行速度快,可以方便快捷地编写出功能强大,运行速度快,并可同时运行于Windows、Unix、 Linux 平台的Web后台程序。
  下载地址:
http://down.chinaz.com/S/7001.asp

http://www.php.net/downloads.php

  1、解压缩文件至/usr/local/src/
  2、进入目录
  #cd /usr/local/src/php-5.0.3
  3、配置
  #./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-mail --with-apxs2=/usr/local/apache/bin/apxs
  4、编译
  #make
  5、安装
  #make install
  6、复制php.ini文件
  #cp php.ini-dist /usr/local/lib/php.ini
  7、编辑/usr/local/apache/conf/httpd.conf
  (1)397附近DirectoryIndex行中加入index.php,变成:

代码:
DirectoryIndex index.php index.html index.html.var index.htm

  (2)827附近的#AddType application/x-tar .tgz下方加入两行:
代码:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

  8、测试
  (1)删除/var/www/html/下index.*文件,编辑index.php保存到这里,内容为:
代码:
<?
phpinfo();
?>


  (2)重启web服务器
  #httpd -k stop
  #httpd -k start
  (3)Firefox地址栏输入http://localhost/,回车。

 

关于php乱码问题:在/etc/ 下 编辑php.ini   <命令:vi php .ini> 找到 ;default_charset = "iso-8859-1"
下面添加或者改为:default_charset = "gb2312"

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值