port安装php+apche+mysql

发表于:2007-05-26来源:作者:点击数: 标签:
安装前先升级ports 1.安装 mysql #cd /usr/ports/databases/mysql41-server 修改makefile,把 数据库 存放位置/var/db/mysql改为/usr/local/mysql #make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_ LINUX THREADS=yes SKIP_DNS_CHECK=yes BUILD_OPTI MI ZED=
安装前先升级ports

1.安装mysql
#cd /usr/ports/databases/mysql41-server
修改makefile,把数据库存放位置/var/db/mysql改为/usr/local/mysql
#make WITH_CHARSET=gbk WITH_XCHARSET=all WITH_LINUXTHREADS=yes SKIP_DNS_CHECK=yes BUILD_OPTIMIZED=yes BUILD_STATIC=yes install clean

#rehash
#mysql_install_db --user=mysql


修改/etc/rc.conf
添加
#mysql
mysql_enable="YES"
mysql_limits="YES"

修改/usr/local/etc/rc.d/mysql-server.sh
把 mysql_dbdir="/var/db/mysql"
改为 mysql_dbdir="/usr/local/mysql"

reboot看看应该能够自启动数据库了

更改mysql root 密碼
#/usr/local/bin/mysqladmin -u root -p password 'mysql_password'
Enter password: //按enter, mysql預設沒有密碼

2.安装apache2
#cd /usr/ports/www/apache2
# make WITH_APACHE_SUEXEC=yes APACHE_HARD_SERVER_LIMIT=1024 APACHE_PERF_TUNING=yes install clean
编辑/etc/rc.conf
添加
#apache2
apache2_enable="YES"

取消所有Options里面的Indexes,禁止浏览目录及文件。
设置KeepAlive Off

启动
/usr/local/etc/rc.d/apache2.sh start

3.安装php4 注:最新的php4.0.0的port好像还没有完善,选项不全,只有手动安装了。
#tar jxvf xxx
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/sbin/apxs --with-config-file-path=/usr/local/php/etc --enable-track-vars --with-xml --with-mysql=/usr/local/ --with-zlib --enable-mbstring
#make
#make install
#make ckean

#gedit /usr/local/etc/apache/httpd.conf

查找

在此范围添加

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

#cp php.ini-dist /usr/local/php/etc/php.ini
/usr/local/etc/rc.d/apache2.sh restart

原文转自:http://www.ltesting.net