php5安装linux,PHP5在Linux下安装

Linux下安装PHP5的主要步骤:

1.下载php5;地址:http://cn.php.net/downloads.php

2.解压软件包后进入该目录

(转者注:

可能会需要先解压php-5.*.tar.bz2 ,先执行bzip2 -d php-5.*tar.bz2

)

tar -xvf php-5.*.tar.gz

cd php-5.*

3.php安装mysql的模块的一些准备工作

ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql

ln -s /usr/local/mysql/include/mysql /usr/include/mysql

ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config

注意:(以后再重新编译不需要执行这些操作)

4.编译安装

#./configure --prefix=/opt/php5

--with-apxs2=/opt/httpd/bin/apxs --with-zlib

--with-config-file-path=/etc --bindir=/usr/bin --sbindir=/usr/sbin

--with-curl --with-exec-dir=/usr/bin --with-xml --with-xmlrpc=shared

--enable-magic-quotes --enable-sockets --enable-mbstring=all

--with-mysql=/usr/bin

(转者注:

其中-prefix为php5安装路径,-apxs2为apache目录下的bin/apxs。)

#make

# make install

5.apache 配置

a、# touch /opt/httpd/conf/extra/httpd-php.conf

文件内容如下:

#

# PHP is an HTML-embedded scripting language which attempts to make it

# easy for developers to write dynamically generated webpages.

#

LoadModule php5_module modules/libphp5.so

#

# Cause the PHP interpreter to handle files with a .php extension.

#

AddHandler php5-script .php

AddType text/html .php

#

# Add index.php to the list of files that will be served as directory

# indexes.

#

DirectoryIndex index.php

#

# Uncomment the following line to allow PHP to pretty-print .phps

# files as PHP source code:

#

#AddType application/x-httpd-php-source .phps

b、修改 httpd.conf,在最后添加一行

vi httpd.conf

....

# php modele

Include conf/extra/httpd-php.conf

c、重启 apache 使之生效。

转自: Linux公社

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值