Lua for PHP 安裝

主要安裝擴充套件資訊 LUA for PHP
使用 Plua 為安裝源.

Linux 安裝方式:
先安裝好 lua:

1
$apt-get install lua5.1 liblua5.1-0-dev

先下載並解開:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ cd /tmp
$ wget http://plua.googlecode.com/files/plua-1.0.0.zip
$ tar zxvf plua-1.0.0.zip
$ cd plua
$ phpize
$ whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
$ rm -f include
$ ln -s /usr/include/lua5.1 include
$ ln -s /usr/lib lib
$ cd lib
$ ln -s /usr/lib/liblua5.1.a liblua.a
$ ln -s /usr/lib/liblua5.1.so liblua.so
$ cd ..
$ make
$ make install
Installing shared extensions:     /usr/lib/php5/20090626/
$

自行編輯php 設定 增加extension=plua.so

FreeBSD 安裝方式:
先安裝好 lua:

1
$cd /usr/port/lang/lua ; make install clean ;

先下載並解開:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ cd /tmp
$ wget http://plua.googlecode.com/files/plua-1.0.0.zip
$ tar zxvf plua-1.0.0.zip
$ cd plua
$ phpize
$ whereis php-config
php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
$ rm -f include
$ ln -s /usr/local/include/lua51 include
$ ln -s /usr/local/lib/lua51 lib
$ cd ..
$ make
$ make install
Installing shared extensions:     /usr/lib/php5/20090626/
$

自行編輯/usr/local/etc/php/extension.ini 設定 增加extension=plua.so

Zend Framework 2.0 體驗~

Zend Framework 2.0

使用前請先參觀ZF2 wiki

安裝方式

前往GIT 作clone 動作取得整個程式.

使用方式

依照正常使用方式 zf create project test1….etc

設定檔與ZF1 不同之處

1
2
3
4
5
6
7
8
resources.db.adapter         = "pdo_mysql"
resources.db.params.host     = "localhost"
resources.db.params.username = "test"
resources.db.params.password = "123456"
resources.db.params.dbname   = "test"
resources.db.params.charset  = "UTF8"
resources.db.params.driver_options.1002 = "SET NAMES utf8"
resources.db.params.profiler.enabled = true
1
2
3
4
5
6
7
8
resources.db.adapter         = "PdoMysql"
resources.db.params.host     = "localhost"
resources.db.params.username = "test"
resources.db.params.password = "123456"
resources.db.params.dbname   = "test"
resources.db.params.charset  = "UTF8"
resources.db.params.driver_options.1002 = "SET NAMES utf8"
resources.db.params.profiler.enabled = true

resources.db.adapter 名稱因為整個架構名稱不同所以必須變更.

FreeBSD 架設 git Server

安裝:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#cd /usr/ports/devel/git; make install clean
------------------------------------------------------------------------
*************************** GITWEB *************************************
If you installed the GITWEB option please follow these instructions:
 
In the directory /usr/local/share/examples/git/gitweb you can find all files to
make gitweb work as a public repository on the web.
 
All you have to do to make gitweb work is:
1) Copy the files /usr/local/share/examples/git/gitweb/* to a directory on
   your web server (e.g. Apache2) in which you are able to execute
   CGI-scripts.
2) In gitweb.cgi, adjust the variable $projectroot to point to
   your git repository (that is where you have your *.git project
   directories).
*************************** GITWEB *************************************
 
*************************** CONTRIB ************************************
If you installed the CONTRIB option please note that the scripts are
installed in /usr/local/share/git-core/contrib. Some of them require
other ports to be installed (perl, python, etc), which you may need to
install manually.
*************************** CONTRIB ************************************
------------------------------------------------------------------------
 
===> Installing rc.d startup script(s)
===>   Compressing manual pages for git-1.7.4.1
===>   Registering installation for git-1.7.4.1
===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/git-core/git-daemon
 
      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/git_daemon
 
      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

For more information, and contact details about the security
status of this software, see the following webpage:
http://git-scm.org/
===> Cleaning for p5-subversion-1.6.15
===> Cleaning for cvsps-2.1
===> Cleaning for git-1.7.4.1

更改設定檔:

1
2
3
git_daemon_enable="YES"
git_daemon_directory="/git"
git_daemon_flags="--export-all --syslog --enable=receive-pack"

新增使用者 git:

1
2
#pw groupadd -n git -g 9418
#pw useradd -n git -u 9418 -g git -c git -d /git -s /usr/local/libexec/git-core/git-shell -h -

更改屬性:

1
2
3
4
5
# chown git:git /git/
# chmod 755 /git
# mkdir /git/repo/
# chown git:git /git/repo/
# chmod 775 /git/repo/

現在要設定哪些使用者有權限在 /git/cnmc/ 底下建立新的 repo。若使用者只需要 commit,不需要加進來:

1
2
3
# vi /etc/group
...
git:*:9418:steve

因為 git 要用 SSH keys(SSH 金鑰)認證,要先收集所有需要 commit 權限的使用者的 SSH keys。然後放到正確的檔案:

1
2
3
4
5
6
# mkdir /git/.ssh/
# chmod 700 /git/.ssh/
# touch /git/.ssh/authorized_keys
# chmod 600 /git/.ssh/authorized_keys
(把公鑰放進 authorized_keys,一行一個)
# chown -R git:git /git/.ssh/

FreeBSD DenyHosts 擋掉暴力破解 ssh 的使用者

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# cd /usr/ports/security/denyhosts; make install clean;
-------------------------------------------------------------------------------
To run denyhosts from startup, add denyhosts_enable="YES"
in your /etc/rc.conf.
Configiration options can be found in /usr/local/etc/denyhosts.conf
-------------------------------------------------------------------------------
In order to proper working of denyhosts
1. edit your /etc/hosts.allow file and add:
sshd : /etc/hosts.deniedssh : deny
sshd : ALL : allow
2. issue the following command if /etc/hosts.deniedssh does not exist yet
touch /etc/hosts.deniedssh 
-------------------------------------------------------------------------------
Warning:
 
syslogd should ideally be run with the -c option; this will ensure that
denyhosts notices multiple repeated login attempts.
 
To do this, add syslogd_flags="-c" to /etc/rc.conf
-------------------------------------------------------------------------------
===> Installing rc.d startup script(s)
===>   Registering installation for denyhosts-2.6_3
===>  Cleaning for denyhosts-2.6_3
#

Read More

FreeBSD 8.2-RELEASE

Release Highlights

The highlights in the 8.2-RELEASE are the following:

  • [amd64] FreeBSD/amd64 now always sets the KVA space as equal to or larger than physical memory size. This change would help to prevent a “kmem_map too small” panic which often occurs when using ZFS.[r214620]
  • The FreeBSD GENERIC kernel is now compiled with KDB and KDB_TRACE options. From 8.2-RELEASE the kernel supports displaying a stack trace on panic by using stack(9) facility with no debugger backend like ddb(8). Note that this does not change the default behaviors of the GENERIC kernel on panic.[r214326]
  • The FreeBSD crypto(4) framework (opencrypto) now supports XTS-AES (XEX-TCB-CTS, or XEX-based Tweaked Code Book mode with CipherText Stealing), which is defined in IEEE Std. 1619-2007.[r214254]
  • [amd64] Xen HVM support in FreeBSD/amd64 kernel has been improved. For more details, see xen(4) manual page.[r215788]
  • FreeBSD now fully supports GPT (GUID Partition Table). Checksums of primary header and primary partition table are verified properly now.[r213994]
  • [amd64, i386] The aesni(4) driver has been added. This supports AES accelerator on Intel CPUs and accelerates AES operations for crypto(4).[r215633]
  • [amd64, i386] The aibs(4) driver has been added. This supports the hardware sensors in ASUS motherboards and replaces the acpi_aiboost(4) driver.[r210476]
  • The tpm(4) driver, which supports Trusted Platform Module has been added.[r215036]
  • The xhci(4) driver, which supports Extensible Host Controller Interface (xHCI) and USB 3.0, has been added.[r215944]
  • The FreeBSD Linux emulation subsystem now supports the video4linux API. This requires native video4linux hardware drivers such as the ones provided by multimedia/pwcbsd and multimedia/webcamd.
  • The miibus(4) has been rewritten for the generic IEEE 802.3 annex 31B full duplex flow control support. The alc(4), bge(4), bce(4), cas(4), fxp(4), gem(4), jme(4), msk(4), nfe(4), re(4), stge(4), and xl(4) drivers along with atphy(4), bmtphy(4), brgphy(4), e1000phy(4), gentbi(4), inphy(4), ip1000phy(4), jmphy(4), nsgphy(4), nsphyter(4), and rgephy(4) have been updated to support flow control via this facility.[r211379, r215881, r215890, r2105894, r216002, r216023, r216029, r216031, r216033]
  • A new netgraph(4) node ng_patch(4) has been added. This performs data modification of packets passing through. Modifications are restricted to a subset of C language operations on unsigned integers of 8, 16, 32 or 64-bit size.[r209843]
  • The FreeBSD TCP reassembly implementation has been improved. A long-standing accounting bug affecting SMP systems has been fixed and the net.inet.tcp.reass.maxqlen sysctl(8) variable has been retired in favor of a per-connection dynamic limit based on the receive socket buffer size. FreeBSD receivers now handle packet loss (particularly losses caused by queue overflows) significantly better than before which improves connection throughput.[r214865, r214866]
  • The siftr(4), Statistical Information For TCP Research (SIFTR) kernel module has been added. This is a facility that logs a range of statistics on active TCP connections to a log file. It provides the ability to make highly granular measurements of TCP connection state, aimed at system administrators, developers and researchers.[r214859]
  • The geli(8) GEOM class now uses XTS-AES mode by default.[r214405]
  • The ZFS on-disk format has been updated to version 15 and various performance improvements for the ZFS have been imported from OpenSolaris.
  • Userland support for the dtrace(1) subsystem has been added. This allows inspection of userland software itself and its correlation with the kernel, thus allowing a much better picture of what exactly is going on behind the scenes. The dtruss(1) utility has been added and libproc has been updated to support the facility.[r214983]
  • The gpart(8) utility now supports a recover subcommand for GPT partition tables.
  • The gpart(8) utility now supports GPT_ENT_ATTR_BOOTME, GPT_ENT_ATTR_BOOTONCE, and GPT_ENT_ATTR_BOOTFAILED attributes in GPT. The attribute keywords in the command line are bootme, bootonce, and bootfailed respectively.[r213994]
  • The libarchive library and tar(1) utility now support LZMA (Lempel-Ziv-Markov chain-Algorithm) compression format.[r213667]
  • The newsyslog(8) utility now supports an -S pidfile option to override the default syslogd(8) PID file.[r211699]
  • The newsyslog(8) utility now supports a special log file name <include> for processing file inclusion. Globbing in the file name and circular dependency detection are supported. For more details, see the newsyslog.conf(5) manual page.[r215622]
  • The pmcstat(8) utility now supports a file and a network socket as a top source. This allows top monitoring over TCP on a system with no local symbols, for example.[r211098]
  • The tftp(1) and tftpd(8) utilities have been improved for better interoperability and they now support RFC 1350, 2347, 2348, 2349, and 3617.[r213036, r213038]
  • A periodic script for zfs scrub has been added. For more details, see the periodic.conf(5) manual page.
  • A periodic script which can be used to find installed ports’ files with mismatched checksum has been added. For more details, see the periodic.conf(5) manual page.
  • The sysinstall(8) utility now uses the following numbers for default and minimum partition sizes: 1GB for /, 4GB for /var, and 1GB for /tmp.[r211007]
  • The ACPI-CA has been updated to 20101013.
  • The ee(1) program has been updated to version 1.5.2.[r214287]
  • ISC BIND has been updated to version 9.6-ESV-R3.
  • netcat has been updated to version 4.8.
  • OpenSSL has been updated to version 0.9.8q.
  • The timezone database has been updated to the tzdata2010o release.
  • The xz has been updated from snapshot as of 12 April 2010 to 5.0.0 release
  • The supported version of the GNOME desktop environment (x11/gnome2) has been updated to 2.32.1.
  • The supported version of the KDE desktop environment (x11/kde4) has been updated to 4.5.5.

FreeBSD 8.2-RELEASE Release Notes

Ntop FreeBSD

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#cd /usr/ports/net/ntop/
#make install clean
...
************************************************************
************************************************************
 
  WARNING: This install created a directory for the ntop
           files and databases:
 
             //usr/local/share/ntop
 
           This directory MUST be owned by the user
           which you are going to use to run ntop.
 
           The command you must issue is something like:
 
           chown -R ntop.ntop //usr/local/share/ntop
     or    chown -R ntop:users //usr/local/share/ntop
 
           man chown to check the syntax for YOUR system
 
************************************************************
************************************************************
# ntop -A
Wed Feb  9 16:55:29 2011  NOTE: Interface merge enabled by default
Wed Feb  9 16:55:29 2011  Initializing gdbm databases
 
 
ntop startup - waiting for user response!
 
 
Please enter the password for the admin user:
Please enter the password again:
Wed Feb  9 16:55:43 2011  Admin user password has been set
#

Doctrine 2 Stable Release!!

2010-12-21 這天 Doctrin2 釋出正式穩定版.
Doctrine 2 First Stable Release
這個版本工程之浩大於2008就開始開發,歷經2年半的時間努力.核心開發團隊五人於最後一年最後整合應用保有 Doctrine 1功能並重構並且導入新的DataMapper.

What is new in Doctrine 2?

* DQL is now a real language inside Doctrine, based on an EBNF that is parsed and transformed to SQL. Benefits of this refactoring are readable error messages, the generation of an AST that allows us to support many different vendors and powerful hooks for developers to modify and extend the DQL language to their needs. DQL can either be written as a string or be generated using a powerful QueryBuilder object.
* Your persistent objects (called entities in Doctrine 2) are not required to extend an abstract base class anymore. Doctrine 2 allows you to use Plain old PHP Objects.
* The UnitOfWork is not an alibi-pattern as implemented in Doctrine 1. It is the most central pattern in Doctrine 2. Instead of calling save() or delete() methods on your Doctrine_Record instances you now pass objects to the data mapper object called EntityManager and it keeps track of all changes until you request a synchronisation between database and the current objects in memory. This process is very efficient and has consistent semantics. This is a significant improvement over Doctrine 1 in terms of performance and developer ease-of-use.
* There are no code-generation steps from YAML to PHP involved in the library anymore. YAML, XML, PHP and Doc-Block Annotations are four first-class citizens for defining the metadata mapping between objects and database. A powerful caching layer allows Doctrine 2 to use runtime metadata without relying on code-generation.
* A clean architecture and powerful algorithms make Doctrine 2 magnitudes faster than Doctrine 1.
* Doctrine 2 supports an API that allows you to transform an arbitrary SQL statements into an object-structure. This feature is used by the Doctrine Query Language itself and is a first-class citizen of the library. It essentially allows you to make use of powerful vendor-specific features and complex SQL statements without having to cirumvent the ORM completely.
* Inheritance is not akward anymore. There are now three different types of inheritance to choose from: Mapped Superclasses, Single-Table- and Joined-Table-Inheritance.
* Many more features, just see the reference guide on what is possible with Doctrine 2.
Read More