Step 3 Installation PHP5.
|
|
Installation of the PHP5:
跟随下面步骤安装 PHP5.
使用Ports方式安装PHP5,进入PHP5所在的Ports安装目录/usr/ports/www/php2执行ake install clean进行安装。
Shell:
whereis php5
php5: /usr/ports/lang/php5
cd /usr/ports/lang/php5/
make install clean |
安装时,会要求进行php5选项设定,这里选择如下
Options for php5 5.2.5
| [X]
| APACHE
| Build Apache module
| [X]
| MULTIBYTE
| Enable zend multibyte support
|
| 安装完成后,输入rehash命令刷新
Shell:
***************************************************************
Make sure index.php is part of your DirectoryIndex.
You should add the following to your Apache configuration file:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
***************************************************************
===>
Cleaning for pkg-config-0.22_1
===>
Cleaning for libxml2-2.6.30
===>
Cleaning for php5-5.2.5
rehash | 系统提示,需要添加以上被标记颜色到httpd.conf文件。
先备份httpd.conf文件
Shell:
cd /usr/local/etc/apache22/
cp httpd.conf httpd.conf.bak | 编辑httpd.conf文件
Shell:
vi /usr/local/etc/apache22/httpd.conf |
编辑/usr/local/etc/apache22/httpd.conf文件,以使Apache Server支持php
编辑/usr/local/etc/apache22/httpd.conf,在AddType application/x-gzip .gz .tgz(大约354行)下面添加添加以下内容
Editor:
index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps |
修改前:
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz |
修改后:
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps |
先不要退出,添加'index.php' 到'DirectoryIndex' 主目录索引(大约212行)
Editor:
DirectoryIndex index.php index.html index.htm |
修改前:
#
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
# |
修改后:
#
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
# | 保存退出后。
[ 本帖最后由 freemongolia 于 2007-11-29 13:36 编辑 ] |