安装php5指南
2009-05-13 00:36:25来源:未知 阅读 ()
A tutorial on installing PHP from the FreeBSD ports for Apache and MySQL. What you need to add to the httpd.conf file and which of the PHP5 ports to choose.
Choosing which port to use
In the past there were several ports for PHP such as /www/mod-php5, /lang/php5-cli, and /lang/php5. Since the release of PHP 5.1.14 there is now only /lang/php5 This port now allows you to choose if you want to install the CLI, CGI, and Apache module.
CLI stands for command line interpreter. It is used for running PHP scripts from the command line and makes creating shell scripts very simple if you already know PHP. The Apache PHP Module is disabled by default, so make SURE that if you plan to use this for web work that you enable it.
Installing the port
Since all PHP ports are now combined you will need to configure it to be sure the parts you need are built.
# cd /usr/ports/lang/php5
# make config
# make install
When you run make config you will be shown a list of options. To use PHP with Apache make sure the Apache Module box is selected.
Once php has installed you will need to install the extra modules for things such as MySQL. These modules are all located in the ports. Some of the most common modules are
/usr/ports/databases/php5-mysql - MySQL Database
/usr/ports/www/php5-session - Sessions
/usr/ports/graphics/php5-gd - Graphics Library
Adding the PHP 5 module to Apache
Apache needs the following lines in the httpd.conf file to use php. These lines should already be added by the port but if you have problems you should double check your httpd.conf file. Note that Apache 2.x does not need the AddModule line.
# Apache 1.3.x
LoadModule php5_module libexec/apache/libphp5.so
AddModule mod_php5.c
# Apache 2.x
LoadModule php5_module libexec/apache/libphp5.so
If you installed using the port and had apache installed already it should do this automatically for you.
Next find your DirectoryIndex section in your httpd.conf file. Apache is set up for PHP 4, but not PHP 5 currently so you will need to modify it and change the 4s to 5s like this.
DirectoryIndex index.php index.php3 index.html
DirectoryIndex index.php3 index.html
DirectoryIndex index.php index.html index.htm
DirectoryIndex index.html
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- FreeBSD下nginx+fast-cgi+mysql+zend的实现 2009-05-13
- gd 安装报错.求助 2009-05-13
- virtualbox for freeBSD 2009-05-13
- 从网上下载的packages为什么本地安装不了?[已解决!] 2009-05-13
- 求PC-BSD 7.1安装指南? 2009-05-13
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash