Showing posts with label freebsd. Show all posts
Showing posts with label freebsd. Show all posts
Thursday, December 25, 2008
[FreeBSD] zip files into separate archive in command line
> for I in * ; do zip -9D "`basename "$I" .nds`.zip" "$I"; done
Saturday, September 27, 2008
[FreeBSD] PHP, MySQL 與 UTF-8 中文亂碼
1. Modify /etc/my.cnf, add "default-character-set = utf8" to the following section.
2. Ensure MySQL environment.
3. Create database and table with UTF-8
4. If your database or table are already created, modify the database and table to UTF-8.
5. PHP Programming : mysql_query("SET NAMES 'utf8'");
[client]
default-character-set = utf8
[mysqld]
default-character-set = utf8
2. Ensure MySQL environment.
SHOW VARIABLES LIKE 'character_set_%';
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/share/mysql/charsets/ |
+--------------------------+----------------------------------+
SHOW VARIABLES LIKE 'collation_%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3. Create database and table with UTF-8
CREATE DATABASE `dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE `table_name` (
`url` VARCHAR(512) NOT NULL ,
PRIMARY KEY ( `url` )
) TYPE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
4. If your database or table are already created, modify the database and table to UTF-8.
ALTER DATABASE `dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ;
ALTER TABLE `table_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
5. PHP Programming : mysql_query("SET NAMES 'utf8'");
$dblink = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_query("SET NAMES 'utf8'");
$dbselect = mysql_select_db($dbname);
Saturday, August 2, 2008
[FreeBSD] 解決Apache中Session Cache is not configured [hint: SSLSessionCache]
裝完php5-extensions之後
重起Apache會出現
Session Cache is not configured [hint: SSLSessionCache]
解決方法:
重起Apache會出現
Session Cache is not configured [hint: SSLSessionCache]
解決方法:
vi /usr/local/etc/php/extensions.ini
把extension=recode.so這行mark起來
/usr/local/sbin/apachectl start
[FreeBSD] Apache, MySQL, and PHP installation
1. 安裝MySQL Client與MySQL Server
2. 安裝Apache
3. 安裝PHP
4.
Restart System
cd /usr/ports/databases/mysql51-client
make install
cd /usr/ports/databases/mysql51-server
make WITH_CHARSET=utf8 WITH_XCHARSET=all WITH_COLLATION=utf8_unicode_ci BUILD_OPTIMIZED=yes BUILD_STATIC=yes install clean
rehash
mysql_install_db
cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf
chown -R mysql:mysql /var/db/mysql
vi /etc/my.cnf
加上
query_cache_size = 32M
[mysqld]
default-character-set = utf8
[client]
default-character-set = utf8
vi /etc/rc.conf
加入
mysql_enable="YES"
/usr/local/bin/mysqld_safe &
mysql -u root
mysql> use mysql ;
mysql> UPDATE user SET password=password('newpasswd') where user='root' ;
mysql> FLUSH PRIVILEGES ;
mysql> exit
2. 安裝Apache
cd /usr/ports/www/apache22
make install clean
vi /etc/rc.conf
加上
apache22_enable="YES"
3. 安裝PHP
cd /usr/ports/lang/php5
make install
cd /usr/ports/lang/php5-extensions
make WITHOUT_X11=yes install clean
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
vi /usr/local/etc/apache22/httpd.conf
加入
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
4.
Restart System
[FreeBSD] 解决apache Failed to enable the ‘httpready’ Accept Filter
灌完FreeBSD 7.0 Release後。
再安裝apache22後。
改完httpd.conf後。
執行/usr/local/sbin/apachectl start
會出現
[warn] (2)No such file or directory: Failed to enable the ‘httpready’ Accept Filter
解決方法如下:
Reference:
http://www.mydigitallife.info/2006/04/23/freebsd-apache-http-accept-filter-error/
再安裝apache22後。
改完httpd.conf後。
執行/usr/local/sbin/apachectl start
會出現
[warn] (2)No such file or directory: Failed to enable the ‘httpready’ Accept Filter
解決方法如下:
1. 執行
> kldload accf_http
2. 修改/boot/defaults/loader.conf 以及 /boot/loader.conf
accf_data_load=”YES”
accf_http_load=”YES”
Reference:
http://www.mydigitallife.info/2006/04/23/freebsd-apache-http-accept-filter-error/
Tuesday, April 8, 2008
[FreeBSD] mldonkey + sancho 安裝與設定
mldonkey with sancho 讓你可以遠端控制FreeBSD上的驢子
1 安裝mldonkey
cd /usr/ports/net-p2p/mldonkey-core
make install
2 設定mldonkey
vi /etc/rc.conf
/usr/local/etc/rc.d/mlnet start
/usr/local/etc/rc.d/mlnet stop
vi ~/.mldonkey/download.ini
cp ~/.mldonkey/downloads.ini ~/.mldonkey/old_config
3 download sancho
http://sancho-gui.sourceforge.net/download.phtml
Referral :
http://www.chmhome.com/knowledge/bsd/20070621/19463.html
http://www.lslnet.com/linux/dosc1/46/linux-317939.htm
http://sancho-gui.sourceforge.net/
1 安裝mldonkey
cd /usr/ports/net-p2p/mldonkey-core
make install
2 設定mldonkey
vi /etc/rc.conf
mlnet_enable="YES"
mlnet_user="mluser"
/usr/local/etc/rc.d/mlnet start
/usr/local/etc/rc.d/mlnet stop
vi ~/.mldonkey/download.ini
allowed_ips = [
"127.0.0.1";
"a.a.a.a";
"b.b.b.b";]
cp ~/.mldonkey/downloads.ini ~/.mldonkey/old_config
3 download sancho
http://sancho-gui.sourceforge.net/download.phtml
Referral :
http://www.chmhome.com/knowledge/bsd/20070621/19463.html
http://www.lslnet.com/linux/dosc1/46/linux-317939.htm
http://sancho-gui.sourceforge.net/
Subscribe to:
Posts (Atom)