五、安装php扩展
# cd /usr/ports/lang/php5-extensions
# make install clean
需要配置 make config install clean
选择安装需要的扩展模块,如:
Options for php5-extensions 1.0
————————————————-
[X] DBASE dBase library support
[X] DOM DOM support
[X] FILEINFO fileinfo support
[X] FILEPRO filePro support
[X] FTP FTP support
[X] GD GD library support
[X] MBSTRING multibyte string support
[X] MySQL MySQL database support
[X] OPENSSL OpenSSL support
[X] PDF PDFlib support (implies GD)
[X] PDO PHP Data Objects Interface (PDO)
[X] POSIX POSIX-like functions
[X] SESSION session support
[X] SIMPLEXML simplexml support
[X] SOAP SOAP support
[X] SOCKETS sockets support
[X] XML XML support
[X] XMLREADER XMLReader support
[X] XMLRPC XMLRPC-EPI support
[X] XMLWRITER XMLWriter support
[X] XSL XSL support (Implies DOM)
[X] ZIP ZIP support
[X] ZLIB ZLIB support
六、配置Apache和Php
1、配置/usr/local/etc/apache22/httpd.conf:
# ee /usr/local/etc/apache22/httpd.conf
修改 DirectoryIndex index.html index.htm index index.php index.phps
2、如果你需要修改网站根目录,就修改下面两个地方,下面仅仅是个例子,大家可根据需要自行修改,确保一致即可。
DocumentRoot "/usr/local/www/web"
3、Options Indexes FollowSymLinks
去掉Indexes可以限制浏览你的主页目录
4、加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps #可不加
*注意:第二行主要为查看php代码用,加上的话web目录下的所有扩展名为.phps的文件在被浏览器访问时都显示其源代码
5、配置/usr/local/etc/php.ini:
# cd /usr/local/etc/
# cp php.ini-recommended php.ini
# ee php.ini
将short_open_tags = Off 改为On,否则不支持短脚本标记
在error_reporting = E_ALL前面加上;
将error_reporting = E_ALL & ~E_NOTICE前面的;去掉
*将报错信息设置改成去掉notice
upload_max_filesize = 2M
上传最大文件尺寸可根据需要修改
date.timezone = CST
设置服务器时区为中国的时区