grep -v '#' httpd.conf.b | grep -v '^$' > httpd.conf
-v 将结果反转
yum -ql mysql
2010年12月23日木曜日
x86_64编译安装PHP出现configure: error: mysql configure failed. Please check config.log的解决方法
编译PHP的时候出下面的错:
checking for mysql_close in -lmysqlclient… no
checking for mysql_error in -lmysqlclient… no
configure: error: mysql configure failed. Please check config.log for more information.
checking for mysql_error in -lmysqlclient… no
configure: error: mysql configure failed. Please check config.log for more information.
网络上说:安装PHP的时候没有指定一下mysql的安装目录。但是已经指定了,所以这个说法是错误的,其实主要原因是 mysql-level没有装,也就是mysql的版本不对,应该换
mysql-max-5.0.21版本(包含所有mysql相关内容的软件包)
mysql-max-5.0.21版本(包含所有mysql相关内容的软件包)
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.so when searching for -lmysqlclient
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 59854 “configure”
#include “confdefs.h”
/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
configure: failed program was:
#line 59854 “configure”
#include “confdefs.h”
在看看config.log提示的错….哦.原来是版本有问题.想起我的系统都是X86的,lib都是64位的.所以解决方法很容易.
这个libmysqlclient.a library 是在 /usr/lib64/mysql, 不是在 /usr/lib/mysql.
所以可以做下面的方法来解决
#export LDFLAGS=-L/usr/lib64/mysql
这个libmysqlclient.a library 是在 /usr/lib64/mysql, 不是在 /usr/lib/mysql.
所以可以做下面的方法来解决
#export LDFLAGS=-L/usr/lib64/mysql
OR
请将Makefile里面的
-L/usr/lib/mysql
改为
-L/usr/lib64/mysql
请将Makefile里面的
-L/usr/lib/mysql
改为
-L/usr/lib64/mysql
2010年12月22日水曜日
php 模块追加
1.cd php-5.1.0/ext/zlib/
2.phpize
3../configure -help
4../configure --with-php-config=/usr/local/bin/php-config
5.make
6.make install
7.vi php.ini
extension config
extension_dir = "/usr/local/lib/php/extensions"
extension=zlib.so
ok
2.phpize
3../configure -help
4../configure --with-php-config=/usr/local/bin/php-config
5.make
6.make install
7.vi php.ini
extension config
extension_dir = "/usr/local/lib/php/extensions"
extension=zlib.so
ok
2010年12月21日火曜日
sqlplus中删除键乱码
sqlplus中删除键(backspace)乱码.如下:
SQL> select value from v$nls_parameters where parameter='NLS_CHARACTERSET';
VALUE
----------------------------------------------------------------
AL32UTF8
----------------------------------------------------------------
AL32UTF8
SQL> alt^H^H^H^H
出现乱码是sqlplus不使用GNU的readline库造成的.
解决方法:
1.可以在使用删除键的同时,按CTRL
2.在BASH下,$stty erase ^H
或把stty erase ^H加到.bash_profile里
2010年12月20日月曜日
PEAR and PECL
Pear:是PHP的扩展代码包,所有的扩展均以PHP代码的形式出现,功能强大,安装简单,甚至可以改改就用。使用的时候,要在代码中进行Include才能够使用。
Pecl:是PHP的标准扩展,可以补充实际开发中所需的功能,所有的扩展都需要安装,在Windows下面以Dll的形式出现,在linux下面,需要单独进行编译,它的表现形式为根据PHP官方的标准用C语言写成,尽管源码开放但是一般人无法随意更改源码。
最直接的表述:Pear是PHP的上层扩展,Pecl是PHP的底层扩展。
这是一些PHP扩展模块的集合
扩展PHP有两种方法
一种是用纯粹的PHP代码写函数和类,pear就是这样一个项目,主页是pear.php.net
另外一种是用c或者c++编写外部模块加载至php中,pecl就是干这个事的,主页是pecl.php.net
这两种方法其实都是为特定的应用提供现成的函数或者类,本质上来说都是一样的
Pecl:是PHP的标准扩展,可以补充实际开发中所需的功能,所有的扩展都需要安装,在Windows下面以Dll的形式出现,在linux下面,需要单独进行编译,它的表现形式为根据PHP官方的标准用C语言写成,尽管源码开放但是一般人无法随意更改源码。
最直接的表述:Pear是PHP的上层扩展,Pecl是PHP的底层扩展。
这是一些PHP扩展模块的集合
扩展PHP有两种方法
一种是用纯粹的PHP代码写函数和类,pear就是这样一个项目,主页是pear.php.net
另外一种是用c或者c++编写外部模块加载至php中,pecl就是干这个事的,主页是pecl.php.net
这两种方法其实都是为特定的应用提供现成的函数或者类,本质上来说都是一样的
2010年12月17日金曜日
linux mount windows Mac OS X share folder
mount //192.168.241.2/pointon_php /mnt/php -o username=administrator,password=huigezi2222
Mount Mac OS X
Mount Mac OS X
进入"System Preferences" -->"Sharing" --> "File Sharing",添加想要共享的文件夹,在选择"Options..." 按钮,选择SMB 共享文件。
mount -o username=name,password=pd //9.100.100.21/alfcee /mnt/test
模块查看
apache2ctl -t -D DUMP_MODULES
php -m
php -m
1. lsmod 列出已经加载的内核模块
lsmod 是列出目前系统中已加载的模块的名称及大小等;另外我们还可以查看 /proc/modules ,我们一样可以知道系统已经加载的模块。
2.modinfo 查看模块信息
modinfo 可以查看模块的信息,通过查看模块信息来判定这个模块的用途。
3.modprobe 挂载新模块以及新模块相依赖的模块
modprobe 我们常用的功能就是挂载模块,在挂载某个内核模块的同时,这个模块所依赖的模块也被同时挂载;当然modprobe 也有列出内核所有模块,还有移除模块的功能;下在我们举个例子说一说咱们常用的功能和参数;
modprobe [-v] [-V] [-C config-file] [-n] [-i] [-q] [-o ] [parameters...]
modprobe -r [-n] [-i] [-v] ...
modprobe -l -t [ -a ...]
modprobe -r [-n] [-i] [-v] ...
modprobe -l -t [ -a ...]
我们可以看到在/etc/modprobe.conf文件中存在的内容形式如下:
alias scsi_hostadapter mptbase |
最后一列是模块名字,中间的是模块的别名。那么如果我们知道了一个模块的名字,怎么知道它的别名呢?用下面的命令就可以:
#modprobe -c |
modprobe -l 是列出内核中所有的模块,包括已挂载和未挂载的;通过modprobe -l ,我们能查看到我们所需要的模块,然后根据我们的需要来挂载;其实modprobe -l 读取的模块列表就位于 /lib/modules/'uname -r' 目录中;其中uname -r 是内核的版本; |
注意: 模块名是不能带有后缀的,我们通过modprobe -l 所看到的模块,都是带有.ko 或.o后缀;
4.rmmod 移除已挂载模块
5.depmod 创建模块依赖关系的列表
这个模块管理工具是创建模块依赖关系的列表,有几个参数我们注意一下就行了,目前的的Linux 发行版所用的内核是2.6x版本,是自动解决依赖关系,所以这个命令知道就行了;模块之前也有依赖关系,比如我们想驱动USB 移动硬盘,目前有两种驱动,一种是udev ,在内核中有,但目前不太稳定;另一种办法是用usb-storage驱动,而usb-storage 依赖的模块是scsi 模块,所以我们要用usb-storage 的模块,也得把scsi 编译安装;
再举个例子:sata的硬盘,在Linux中的设备表示的是/dev/sd* ,比如 /dev/sda,/dev/sdb 等... 系统要驱动 sata硬盘,则需要把sata在内核中选中,或编译成模块,或内置于内核之中,在此同时,还需要在内核中选中ide ,scsi 的支持等;
depmod 工具的洋文原意:depmod — program to generate modules.dep and map files.(我译的:为modules.dep 文件或映射文件创建依赖关系)
[root@localhost beinan]# depmod -a 注:为所有列在/etc/modprobe.conf 或/etc/modules.conf 中的所有模块创建依赖关系,并且写入到modules.dep文件;
[root@localhost beinan]# depmod -e 注:列出已挂载但不可用的模块;
[root@localhost beinan]# depmod -n 注:列出所有模块的依赖关系,但仅仅是输出出来 (Write the dependency file on stdout only)
[root@localhost beinan]# depmod -e 注:列出已挂载但不可用的模块;
[root@localhost beinan]# depmod -n 注:列出所有模块的依赖关系,但仅仅是输出出来 (Write the dependency file on stdout only)
注:modules.dep 位于 /lib/modules/内核版本 目录
php インストール
wget http://museum.php.net/php5/php-5.1.0.tar.gz
tar zxvf php-5.1.0.tar.gz
cd php-5.1.0
yum install flex
yum install libxml2
yum install libxslt-devel
yum install curl curl-devel
yum install libmcrypt libmcrypt-devel
./configure
--with-apxs2=/usr/sbin/apxs
--with-mysql
--enable-track-vars
--enable-mbstring
--enable-ftp
--with-openssl
--with-ssl
--with-curl
--with-mcrypt
make
make install
make clean
./configure --with-apxs2=/usr/sbin/apxs --with-pgsql=/usr/local/pgsql/bin/pg_config --with-pdo-pgsql=/usr/local/pgsql/bin/pg_config \
--enable-track-vars --enable-mbstring --enable-ftp --with-openssl --with-ssl --with-curl --with-mcrypt
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print `checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
--enable and --with options recognized:
--with-libdir=NAME Look for libraries in .../NAME rather than .../lib
--disable-rpath Disable passing additional runtime library
search paths
--enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension
SAPI modules:
--with-aolserver=DIR Specify path to the installed AOLserver
--with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
build directory [/usr/local/apache]
--enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)
--with-apxs2filter[=FILE]
EXPERIMENTAL: Build shared Apache 2.0 Filter module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache-hooks[=FILE]
EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache-hooks-static[=DIR]
EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
build directory [/usr/local/apache]
--enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)
--with-caudium[=DIR] Build PHP as a Pike module for use with Caudium.
DIR is the Caudium server dir [/usr/local/caudium/server]
--disable-cli Disable building CLI version of PHP
(this forces --without-pear)
--with-continuity=DIR Build PHP as Continuity Server module.
DIR is path to the installed Continuity Server root
--enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
TYPE is either 'shared' or 'static'. [TYPE=shared]
--with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus
--with-litespeed Build PHP as litespeed module
--with-milter[=DIR] Build PHP as Milter application
--with-nsapi=DIR Build PHP as NSAPI module for Netscape/iPlanet/Sun Webserver
--with-phttpd=DIR Build PHP as phttpd module
--with-pi3web[=DIR] Build PHP as Pi3Web module
--with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
directory, normally /usr/local/roxen/server
--enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety
--with-thttpd=SRCDIR Build PHP as thttpd module
--with-tux=MODULEDIR Build PHP as a TUX module (Linux only)
--with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only)
--disable-cgi Disable building CGI version of PHP
General settings:
--enable-gcov Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!
--enable-debug Compile with debugging symbols
--with-layout=TYPE Set how installed files will be laid out. Type can
be either PHP or GNU [PHP]
--with-config-file-path=PATH
Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH
Set the path where to scan for configuration files
--enable-safe-mode Enable safe mode by default
--with-exec-dir[=DIR] Only allow executables in DIR under safe-mode
[/usr/local/php/bin]
--enable-sigchild Enable PHP's own SIGCHLD handler
--enable-magic-quotes Enable magic quotes by default.
--enable-libgcc Enable explicitly linking against libgcc
--disable-short-tags Disable the short-form = 0.9.6)
--with-kerberos[=DIR] OPENSSL: Include Kerberos support
--with-pcre-regex=DIR Include Perl Compatible Regular Expressions support.
DIR is the PCRE install prefix [BUNDLED]
--without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to
SQLite3 installation directory.
--with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)
--with-zlib-dir=
Define the location of zlib install directory
--enable-bcmath Enable bc style precision math functions
--with-bz2[=DIR] Include BZip2 support
--enable-calendar Enable support for calendar conversion
--disable-ctype Disable ctype functions
--with-curl[=DIR] Include cURL support
--with-curlwrappers Use cURL for url streams
--enable-dba Build DBA with bundled modules. To build shared DBA
extension use --enable-dba=shared
--with-qdbm[=DIR] DBA: QDBM support
--with-gdbm[=DIR] DBA: GDBM support
--with-ndbm[=DIR] DBA: NDBM support
--with-db4[=DIR] DBA: Berkeley DB4 support
--with-db3[=DIR] DBA: Berkeley DB3 support
--with-db2[=DIR] DBA: Berkeley DB2 support
--with-db1[=DIR] DBA: Berkeley DB1 support/emulation
--with-dbm[=DIR] DBA: DBM support
--without-cdb[=DIR] DBA: CDB support (bundled)
--disable-inifile DBA: INI support (bundled)
--disable-flatfile DBA: FlatFile support (bundled)
--disable-dom Disable DOM support
--with-libxml-dir[=DIR] DOM: libxml2 install prefix
--with-enchant[=DIR] Include enchant support.
GNU Aspell version 1.1.3 or higher required.
--enable-exif Enable EXIF (metadata from images) support
--disable-fileinfo Disable fileinfo support
--disable-filter Disable input filter support
--with-pcre-dir FILTER: pcre install prefix
--enable-ftp Enable FTP support
--with-openssl-dir[=DIR] FTP: openssl install prefix
--with-gd[=DIR] Include GD support. DIR is the GD library base
install directory [BUNDLED]
--with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix
--with-png-dir[=DIR] GD: Set the path to libpng install prefix
--with-zlib-dir[=DIR] GD: Set the path to libz install prefix
--with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix
--with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
--with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required
--enable-gd-native-ttf GD: Enable TrueType string function
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support
--with-gettext[=DIR] Include GNU gettext support
--with-gmp[=DIR] Include GNU MP support
--with-mhash[=DIR] Include mhash support
--disable-hash Disable hash support
--without-iconv[=DIR] Exclude iconv support
--with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix
--with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix
--with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix
--with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
install directory [/usr/interbase]
--enable-intl Enable internationalization support
--with-icu-dir=DIR Specify where ICU libraries and headers can be found
--disable-json Disable JavaScript Object Serialization support
--with-ldap[=DIR] Include LDAP support
--with-ldap-sasl[=DIR] LDAP: Include Cyrus SASL support
--enable-mbstring Enable multibyte string support
--disable-mbregex MBSTRING: Disable multibyte regex support
--disable-mbregex-backtrack
MBSTRING: Disable multibyte regex backtrack check
--with-libmbfl[=DIR] MBSTRING: Use external libmbfl. DIR is the libmbfl base
install directory [BUNDLED]
--with-onig[=DIR] MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
If DIR is not set, the bundled oniguruma will be used
--with-mcrypt[=DIR] Include mcrypt support
--with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home
directory [/usr/local/freetds]
--with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
directory. If mysqlnd is passed as DIR,
the MySQL native driver will be used [/usr/local]
--with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched
--with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix
--with-mysqli[=FILE] Include MySQLi support. FILE is the path
to mysql_config. If mysqlnd is passed as FILE,
the MySQL native driver will be used [mysql_config]
--enable-embedded-mysqli MYSQLi: Enable embedded support
Note: Does not work with MySQL native driver!
--with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to $ORACLE_HOME.
Use --with-oci8=instantclient,/path/to/instant/client/lib
to use an Oracle Instant Client installation
--with-adabas[=DIR] Include Adabas D support [/usr/local]
--with-sapdb[=DIR] Include SAP DB support [/usr/local]
--with-solid[=DIR] Include Solid support [/usr/local/solid]
--with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]
--with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]
--with-empress[=DIR] Include Empress support [$EMPRESSPATH]
(Empress Version >= 8.60 required)
--with-empress-bcs[=DIR]
Include Empress Local Access support [$EMPRESSPATH]
(Empress Version >= 8.60 required)
--with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]
--with-custom-odbc[=DIR]
Include user defined ODBC support. DIR is ODBC install base
directory [/usr/local]. Make sure to define CUSTOM_ODBC_LIBS and
have some odbc.h in your include dirs. f.e. you should define
following for Sybase SQL Anywhere 5.5.00 on QNX, prior to
running this configure script:
CPPFLAGS="-DODBC_QNX -DSQLANY_BUG"
LDFLAGS=-lunix
CUSTOM_ODBC_LIBS="-ldblib -lodbc"
--with-iodbc[=DIR] Include iODBC support [/usr/local]
--with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]
--with-unixODBC[=DIR] Include unixODBC support [/usr/local]
--with-dbmaker[=DIR] Include DBMaker support
--enable-pcntl Enable pcntl support (CLI/CGI only)
--disable-pdo Disable PHP Data Objects support
--with-pdo-dblib[=DIR] PDO: DBLIB-DB support. DIR is the FreeTDS home directory
--with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base
install directory [/opt/firebird]
--with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directoy
If mysqlnd is passed as DIR, the MySQL native
native driver will be used [/usr/local]
--with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix
--with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
Use --with-pdo-oci=instantclient,prefix,version
for an Oracle Instant Client SDK.
For Linux with 10.2.0.3 RPMs (for example) use:
--with-pdo-oci=instantclient,/usr,10.2.0.3
--with-pdo-odbc=flavour,dir
PDO: Support for 'flavour' ODBC driver.
include and lib dirs are looked for under 'dir'.
'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic
If ',dir' part is omitted, default for the flavour
you have selected will used. e.g.:
--with-pdo-odbc=unixODBC
will check for unixODBC under /usr/local. You may attempt
to use an otherwise unsupported driver using the "generic"
flavour. The syntax for generic ODBC support is:
--with-pdo-odbc=generic,dir,libname,ldflags,cflags
When build as shared the extension filename is always pdo_odbc.so
--with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL base
install directory or the path to pg_config
--without-pdo-sqlite[=DIR]
PDO: sqlite 3 support. DIR is the sqlite base
install directory [BUNDLED]
--with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
base install directory or the path to pg_config
--disable-phar Disable phar support
--disable-posix Disable POSIX-like functions
--with-pspell[=DIR] Include PSPELL support.
GNU Aspell version 0.50.0 or higher required
--with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)
--with-readline[=DIR] Include readline support (CLI/CGI only)
--with-recode[=DIR] Include recode support
--disable-session Disable session support
--with-mm[=DIR] SESSION: Include mm support for session storage
--enable-shmop Enable shmop support
--disable-simplexml Disable SimpleXML support
--with-libxml-dir=DIR SimpleXML: libxml2 install prefix
--with-snmp[=DIR] Include SNMP support
--with-openssl-dir[=DIR] SNMP: openssl install prefix
--enable-ucd-snmp-hack SNMP: Enable UCD SNMP hack
--enable-soap Enable SOAP support
--with-libxml-dir=DIR SOAP: libxml2 install prefix
--enable-sockets Enable sockets support
--without-sqlite=DIR Do not include sqlite support. DIR is the sqlite base
install directory [BUNDLED]
--enable-sqlite-utf8 SQLite: Enable UTF-8 support for SQLite
--with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home
directory [/home/sybase]
--enable-sysvmsg Enable sysvmsg support
--enable-sysvsem Enable System V semaphore support
--enable-sysvshm Enable the System V shared memory support
--with-tidy[=DIR] Include TIDY support
--disable-tokenizer Disable tokenizer support
--enable-wddx Enable WDDX support
--with-libxml-dir=DIR WDDX: libxml2 install prefix
--with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)
--disable-xml Disable XML support
--with-libxml-dir=DIR XML: libxml2 install prefix
--with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)
--disable-xmlreader Disable XMLReader support
--with-libxml-dir=DIR XMLReader: libxml2 install prefix
--with-xmlrpc[=DIR] Include XMLRPC-EPI support
--with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix
--with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)
--with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI
--disable-xmlwriter Disable XMLWriter support
--with-libxml-dir=DIR XMLWriter: libxml2 install prefix
--with-xsl[=DIR] Include XSL support. DIR is the libxslt base
install directory (libxslt >= 1.1.0 required)
--enable-zip Include Zip read/write support
--with-zlib-dir[=DIR] ZIP: Set the path to libz install prefix
--with-pcre-dir ZIP: pcre install prefix
--enable-mysqlnd-threading
EXPERIMENTAL: Enable mysqlnd threaded fetch.
Note: This forces ZTS on!
PEAR:
--with-pear=DIR Install PEAR in DIR [PREFIX/lib/php]
--without-pear Do not install PEAR
Zend:
--with-zend-vm=TYPE Set virtual machine dispatch method. Type is
one of CALL, SWITCH or GOTO [TYPE=CALL]
--enable-maintainer-zts Enable thread safety - for code maintainers only!!
--disable-inline-optimization
If building zend_execute.lo fails, try this switch
--enable-zend-multibyte Compile with zend multibyte support
TSRM:
--with-tsrm-pth[=pth-config]
Use GNU Pth
--with-tsrm-st Use SGI's State Threads
--with-tsrm-pthreads Use POSIX threads (default)
Libtool:
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS] optimize for fast installation [default=yes]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--disable-libtool-lock avoid locking (might break parallel builds)
--with-pic try to use only PIC/non-PIC objects [default=use both]
--with-tags[=TAGS] include additional configurations [automatic]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
tar zxvf php-5.1.0.tar.gz
cd php-5.1.0
yum install flex
yum install libxml2
yum install libxslt-devel
yum install curl curl-devel
yum install libmcrypt libmcrypt-devel
./configure
--with-apxs2=/usr/sbin/apxs
--with-mysql
--enable-track-vars
--enable-mbstring
--enable-ftp
--with-openssl
--with-ssl
--with-curl
--with-mcrypt
make
make install
make clean
./configure --with-apxs2=/usr/sbin/apxs --with-pgsql=/usr/local/pgsql/bin/pg_config --with-pdo-pgsql=/usr/local/pgsql/bin/pg_config \
--enable-track-vars --enable-mbstring --enable-ftp --with-openssl --with-ssl --with-curl --with-mcrypt
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
--cache-file=FILE cache test results in FILE
--help print this message
--no-create do not create output files
--quiet, --silent do not print `checking...' messages
--version print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[same as prefix]
--bindir=DIR user executables in DIR [EPREFIX/bin]
--sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
--libexecdir=DIR program executables in DIR [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data in DIR
[PREFIX/share]
--sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data in DIR
[PREFIX/com]
--localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
--libdir=DIR object code libraries in DIR [EPREFIX/lib]
--includedir=DIR C header files in DIR [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
--infodir=DIR info documentation in DIR [PREFIX/info]
--mandir=DIR man documentation in DIR [PREFIX/man]
--srcdir=DIR find the sources in DIR [configure dir or ..]
--program-prefix=PREFIX prepend PREFIX to installed program names
--program-suffix=SUFFIX append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
Host type:
--build=BUILD configure for building on BUILD [BUILD=HOST]
--host=HOST configure for HOST [guessed]
--target=TARGET configure for TARGET [TARGET=HOST]
Features and packages:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--x-includes=DIR X include files are in DIR
--x-libraries=DIR X library files are in DIR
--enable and --with options recognized:
--with-libdir=NAME Look for libraries in .../NAME rather than .../lib
--disable-rpath Disable passing additional runtime library
search paths
--enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension
SAPI modules:
--with-aolserver=DIR Specify path to the installed AOLserver
--with-apxs[=FILE] Build shared Apache 1.x module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache[=DIR] Build Apache 1.x module. DIR is the top-level Apache
build directory [/usr/local/apache]
--enable-mod-charset APACHE: Enable transfer tables for mod_charset (Rus Apache)
--with-apxs2filter[=FILE]
EXPERIMENTAL: Build shared Apache 2.0 Filter module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apxs2[=FILE] Build shared Apache 2.0 Handler module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache-hooks[=FILE]
EXPERIMENTAL: Build shared Apache 1.x module. FILE is the optional
pathname to the Apache apxs tool [apxs]
--with-apache-hooks-static[=DIR]
EXPERIMENTAL: Build Apache 1.x module. DIR is the top-level Apache
build directory [/usr/local/apache]
--enable-mod-charset APACHE (hooks): Enable transfer tables for mod_charset (Rus Apache)
--with-caudium[=DIR] Build PHP as a Pike module for use with Caudium.
DIR is the Caudium server dir [/usr/local/caudium/server]
--disable-cli Disable building CLI version of PHP
(this forces --without-pear)
--with-continuity=DIR Build PHP as Continuity Server module.
DIR is path to the installed Continuity Server root
--enable-embed[=TYPE] EXPERIMENTAL: Enable building of embedded SAPI library
TYPE is either 'shared' or 'static'. [TYPE=shared]
--with-isapi[=DIR] Build PHP as an ISAPI module for use with Zeus
--with-litespeed Build PHP as litespeed module
--with-milter[=DIR] Build PHP as Milter application
--with-nsapi=DIR Build PHP as NSAPI module for Netscape/iPlanet/Sun Webserver
--with-phttpd=DIR Build PHP as phttpd module
--with-pi3web[=DIR] Build PHP as Pi3Web module
--with-roxen=DIR Build PHP as a Pike module. DIR is the base Roxen
directory, normally /usr/local/roxen/server
--enable-roxen-zts ROXEN: Build the Roxen module using Zend Thread Safety
--with-thttpd=SRCDIR Build PHP as thttpd module
--with-tux=MODULEDIR Build PHP as a TUX module (Linux only)
--with-webjames=SRCDIR Build PHP as a WebJames module (RISC OS only)
--disable-cgi Disable building CGI version of PHP
General settings:
--enable-gcov Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!
--enable-debug Compile with debugging symbols
--with-layout=TYPE Set how installed files will be laid out. Type can
be either PHP or GNU [PHP]
--with-config-file-path=PATH
Set the path in which to look for php.ini [PREFIX/lib]
--with-config-file-scan-dir=PATH
Set the path where to scan for configuration files
--enable-safe-mode Enable safe mode by default
--with-exec-dir[=DIR] Only allow executables in DIR under safe-mode
[/usr/local/php/bin]
--enable-sigchild Enable PHP's own SIGCHLD handler
--enable-magic-quotes Enable magic quotes by default.
--enable-libgcc Enable explicitly linking against libgcc
--disable-short-tags Disable the short-form = 0.9.6)
--with-kerberos[=DIR] OPENSSL: Include Kerberos support
--with-pcre-regex=DIR Include Perl Compatible Regular Expressions support.
DIR is the PCRE install prefix [BUNDLED]
--without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to
SQLite3 installation directory.
--with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.0.9)
--with-zlib-dir=
Define the location of zlib install directory
--enable-bcmath Enable bc style precision math functions
--with-bz2[=DIR] Include BZip2 support
--enable-calendar Enable support for calendar conversion
--disable-ctype Disable ctype functions
--with-curl[=DIR] Include cURL support
--with-curlwrappers Use cURL for url streams
--enable-dba Build DBA with bundled modules. To build shared DBA
extension use --enable-dba=shared
--with-qdbm[=DIR] DBA: QDBM support
--with-gdbm[=DIR] DBA: GDBM support
--with-ndbm[=DIR] DBA: NDBM support
--with-db4[=DIR] DBA: Berkeley DB4 support
--with-db3[=DIR] DBA: Berkeley DB3 support
--with-db2[=DIR] DBA: Berkeley DB2 support
--with-db1[=DIR] DBA: Berkeley DB1 support/emulation
--with-dbm[=DIR] DBA: DBM support
--without-cdb[=DIR] DBA: CDB support (bundled)
--disable-inifile DBA: INI support (bundled)
--disable-flatfile DBA: FlatFile support (bundled)
--disable-dom Disable DOM support
--with-libxml-dir[=DIR] DOM: libxml2 install prefix
--with-enchant[=DIR] Include enchant support.
GNU Aspell version 1.1.3 or higher required.
--enable-exif Enable EXIF (metadata from images) support
--disable-fileinfo Disable fileinfo support
--disable-filter Disable input filter support
--with-pcre-dir FILTER: pcre install prefix
--enable-ftp Enable FTP support
--with-openssl-dir[=DIR] FTP: openssl install prefix
--with-gd[=DIR] Include GD support. DIR is the GD library base
install directory [BUNDLED]
--with-jpeg-dir[=DIR] GD: Set the path to libjpeg install prefix
--with-png-dir[=DIR] GD: Set the path to libpng install prefix
--with-zlib-dir[=DIR] GD: Set the path to libz install prefix
--with-xpm-dir[=DIR] GD: Set the path to libXpm install prefix
--with-freetype-dir[=DIR] GD: Set the path to FreeType 2 install prefix
--with-t1lib[=DIR] GD: Include T1lib support. T1lib version >= 5.0.0 required
--enable-gd-native-ttf GD: Enable TrueType string function
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support
--with-gettext[=DIR] Include GNU gettext support
--with-gmp[=DIR] Include GNU MP support
--with-mhash[=DIR] Include mhash support
--disable-hash Disable hash support
--without-iconv[=DIR] Exclude iconv support
--with-imap[=DIR] Include IMAP support. DIR is the c-client install prefix
--with-kerberos[=DIR] IMAP: Include Kerberos support. DIR is the Kerberos install prefix
--with-imap-ssl[=DIR] IMAP: Include SSL support. DIR is the OpenSSL install prefix
--with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
install directory [/usr/interbase]
--enable-intl Enable internationalization support
--with-icu-dir=DIR Specify where ICU libraries and headers can be found
--disable-json Disable JavaScript Object Serialization support
--with-ldap[=DIR] Include LDAP support
--with-ldap-sasl[=DIR] LDAP: Include Cyrus SASL support
--enable-mbstring Enable multibyte string support
--disable-mbregex MBSTRING: Disable multibyte regex support
--disable-mbregex-backtrack
MBSTRING: Disable multibyte regex backtrack check
--with-libmbfl[=DIR] MBSTRING: Use external libmbfl. DIR is the libmbfl base
install directory [BUNDLED]
--with-onig[=DIR] MBSTRING: Use external oniguruma. DIR is the oniguruma install prefix.
If DIR is not set, the bundled oniguruma will be used
--with-mcrypt[=DIR] Include mcrypt support
--with-mssql[=DIR] Include MSSQL-DB support. DIR is the FreeTDS home
directory [/usr/local/freetds]
--with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
directory. If mysqlnd is passed as DIR,
the MySQL native driver will be used [/usr/local]
--with-mysql-sock[=DIR] MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
If unspecified, the default locations are searched
--with-zlib-dir[=DIR] MySQL: Set the path to libz install prefix
--with-mysqli[=FILE] Include MySQLi support. FILE is the path
to mysql_config. If mysqlnd is passed as FILE,
the MySQL native driver will be used [mysql_config]
--enable-embedded-mysqli MYSQLi: Enable embedded support
Note: Does not work with MySQL native driver!
--with-oci8[=DIR] Include Oracle (OCI8) support. DIR defaults to $ORACLE_HOME.
Use --with-oci8=instantclient,/path/to/instant/client/lib
to use an Oracle Instant Client installation
--with-adabas[=DIR] Include Adabas D support [/usr/local]
--with-sapdb[=DIR] Include SAP DB support [/usr/local]
--with-solid[=DIR] Include Solid support [/usr/local/solid]
--with-ibm-db2[=DIR] Include IBM DB2 support [/home/db2inst1/sqllib]
--with-ODBCRouter[=DIR] Include ODBCRouter.com support [/usr]
--with-empress[=DIR] Include Empress support [$EMPRESSPATH]
(Empress Version >= 8.60 required)
--with-empress-bcs[=DIR]
Include Empress Local Access support [$EMPRESSPATH]
(Empress Version >= 8.60 required)
--with-birdstep[=DIR] Include Birdstep support [/usr/local/birdstep]
--with-custom-odbc[=DIR]
Include user defined ODBC support. DIR is ODBC install base
directory [/usr/local]. Make sure to define CUSTOM_ODBC_LIBS and
have some odbc.h in your include dirs. f.e. you should define
following for Sybase SQL Anywhere 5.5.00 on QNX, prior to
running this configure script:
CPPFLAGS="-DODBC_QNX -DSQLANY_BUG"
LDFLAGS=-lunix
CUSTOM_ODBC_LIBS="-ldblib -lodbc"
--with-iodbc[=DIR] Include iODBC support [/usr/local]
--with-esoob[=DIR] Include Easysoft OOB support [/usr/local/easysoft/oob/client]
--with-unixODBC[=DIR] Include unixODBC support [/usr/local]
--with-dbmaker[=DIR] Include DBMaker support
--enable-pcntl Enable pcntl support (CLI/CGI only)
--disable-pdo Disable PHP Data Objects support
--with-pdo-dblib[=DIR] PDO: DBLIB-DB support. DIR is the FreeTDS home directory
--with-pdo-firebird[=DIR] PDO: Firebird support. DIR is the Firebird base
install directory [/opt/firebird]
--with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directoy
If mysqlnd is passed as DIR, the MySQL native
native driver will be used [/usr/local]
--with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix
--with-pdo-oci[=DIR] PDO: Oracle OCI support. DIR defaults to $ORACLE_HOME.
Use --with-pdo-oci=instantclient,prefix,version
for an Oracle Instant Client SDK.
For Linux with 10.2.0.3 RPMs (for example) use:
--with-pdo-oci=instantclient,/usr,10.2.0.3
--with-pdo-odbc=flavour,dir
PDO: Support for 'flavour' ODBC driver.
include and lib dirs are looked for under 'dir'.
'flavour' can be one of: ibm-db2, iODBC, unixODBC, generic
If ',dir' part is omitted, default for the flavour
you have selected will used. e.g.:
--with-pdo-odbc=unixODBC
will check for unixODBC under /usr/local. You may attempt
to use an otherwise unsupported driver using the "generic"
flavour. The syntax for generic ODBC support is:
--with-pdo-odbc=generic,dir,libname,ldflags,cflags
When build as shared the extension filename is always pdo_odbc.so
--with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL base
install directory or the path to pg_config
--without-pdo-sqlite[=DIR]
PDO: sqlite 3 support. DIR is the sqlite base
install directory [BUNDLED]
--with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
base install directory or the path to pg_config
--disable-phar Disable phar support
--disable-posix Disable POSIX-like functions
--with-pspell[=DIR] Include PSPELL support.
GNU Aspell version 0.50.0 or higher required
--with-libedit[=DIR] Include libedit readline replacement (CLI/CGI only)
--with-readline[=DIR] Include readline support (CLI/CGI only)
--with-recode[=DIR] Include recode support
--disable-session Disable session support
--with-mm[=DIR] SESSION: Include mm support for session storage
--enable-shmop Enable shmop support
--disable-simplexml Disable SimpleXML support
--with-libxml-dir=DIR SimpleXML: libxml2 install prefix
--with-snmp[=DIR] Include SNMP support
--with-openssl-dir[=DIR] SNMP: openssl install prefix
--enable-ucd-snmp-hack SNMP: Enable UCD SNMP hack
--enable-soap Enable SOAP support
--with-libxml-dir=DIR SOAP: libxml2 install prefix
--enable-sockets Enable sockets support
--without-sqlite=DIR Do not include sqlite support. DIR is the sqlite base
install directory [BUNDLED]
--enable-sqlite-utf8 SQLite: Enable UTF-8 support for SQLite
--with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home
directory [/home/sybase]
--enable-sysvmsg Enable sysvmsg support
--enable-sysvsem Enable System V semaphore support
--enable-sysvshm Enable the System V shared memory support
--with-tidy[=DIR] Include TIDY support
--disable-tokenizer Disable tokenizer support
--enable-wddx Enable WDDX support
--with-libxml-dir=DIR WDDX: libxml2 install prefix
--with-libexpat-dir=DIR WDDX: libexpat dir for XMLRPC-EPI (deprecated)
--disable-xml Disable XML support
--with-libxml-dir=DIR XML: libxml2 install prefix
--with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)
--disable-xmlreader Disable XMLReader support
--with-libxml-dir=DIR XMLReader: libxml2 install prefix
--with-xmlrpc[=DIR] Include XMLRPC-EPI support
--with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix
--with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)
--with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI
--disable-xmlwriter Disable XMLWriter support
--with-libxml-dir=DIR XMLWriter: libxml2 install prefix
--with-xsl[=DIR] Include XSL support. DIR is the libxslt base
install directory (libxslt >= 1.1.0 required)
--enable-zip Include Zip read/write support
--with-zlib-dir[=DIR] ZIP: Set the path to libz install prefix
--with-pcre-dir ZIP: pcre install prefix
--enable-mysqlnd-threading
EXPERIMENTAL: Enable mysqlnd threaded fetch.
Note: This forces ZTS on!
PEAR:
--with-pear=DIR Install PEAR in DIR [PREFIX/lib/php]
--without-pear Do not install PEAR
Zend:
--with-zend-vm=TYPE Set virtual machine dispatch method. Type is
one of CALL, SWITCH or GOTO [TYPE=CALL]
--enable-maintainer-zts Enable thread safety - for code maintainers only!!
--disable-inline-optimization
If building zend_execute.lo fails, try this switch
--enable-zend-multibyte Compile with zend multibyte support
TSRM:
--with-tsrm-pth[=pth-config]
Use GNU Pth
--with-tsrm-st Use SGI's State Threads
--with-tsrm-pthreads Use POSIX threads (default)
Libtool:
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS] optimize for fast installation [default=yes]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--disable-libtool-lock avoid locking (might break parallel builds)
--with-pic try to use only PIC/non-PIC objects [default=use both]
--with-tags[=TAGS] include additional configurations [automatic]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
2010年12月9日木曜日
php 笔记1
面向对象特性
public/private/protected访问修饰符,针对对象中的方法和属性
统一的构造函数名称__construct().
通过__destructor()定义对象的析构方法
接口
instanceof操作符
final方法--不能被子类重载
final标记类 --不能被子类继承
强制复制对象 必须用clone关键字
类中的常量可以用类来引用 const AA="AA" --> Class::AA
静态方法 不支持$this变量 Class::method();
静态成员 通过类自身来访问 self::$instance;
抽象类 防止被实例化
抽象方法
对象类型提示 函数声明中对参数进行对象类型提示,不正确系统报错
支持连续引用方法返回的对象 $obj->method()->method2();
迭代 实现Iterator接口后,可以用foreach()遍历一个类实例
__autoload()方法
其他特性
try/throw/catch 你只能抛出继承Exception的类
foreach 函数支持引用 循环参数加上&符号,可以在循环中更改数组的值
给引用参数设置默认值 php4只能给传递值的参数设置默认值,php5可以给传递引用的参数设置默认值
基础
php不支持全局变量,除了一些预定义的变量
间接引用
管理变量
isset() 用来判断某个变量是否已经被声明。返回布尔值
isset(v1,v2,v3…)可以接受多个参数,所有变量都定义的情况下才返回true
unset()取消定义之前的变量,如果没有其他变量引用它的话会释放变量使用的内存空间
empty() 判断变量是否没被声明或者值是false
预定义超全局变量
$_GET[],$_POST[],$_COOKIE[],$_ENV[],$_SERVER[]
基础数据类型
8种数据类型
整型
浮点型数字
字符串
单引号不支持双引号的转义和变量替换 定界符以<<<符号开始,紧跟的字符串不能在文本中出现。
定界符转义和变量替换基本和双引号相同,不同的是不需要转义双引号。
访问字符串中的字符 $str{1}
布尔型 空字符串("")和0("0")字符串为false
NULL
Resources
数组 php的数组是使用哈希表构建的。 array([key=>] value,[key=>] value,...) 方括号中元素可选
访问数组元素
$arr1[0]
使用foreach遍历数组
常量 define("CONSTANT_NAME",value [,case_sensitivity]) case_sensitivity大小写敏感,默认true
比较运算
1=="1" true
1==1 true
1==="1" false
1===1 true
类型转换
(int),(integer)
(float),(real),(double)
(string)
(bool),(Boolean)
(array)
(object)
代码包含控制结构
include file_name;
require file_name; require会停止代码执行,include只会警告
eval() 把代码当作字符串包含进来再执行
通过值返回数据
通过引用返回数据
传递值的参数
传递引用的参数
默认参数
public/private/protected访问修饰符,针对对象中的方法和属性
统一的构造函数名称__construct().
通过__destructor()定义对象的析构方法
接口
instanceof操作符
final方法--不能被子类重载
final标记类 --不能被子类继承
强制复制对象 必须用clone关键字
类中的常量可以用类来引用 const AA="AA" --> Class::AA
静态方法 不支持$this变量 Class::method();
静态成员 通过类自身来访问 self::$instance;
抽象类 防止被实例化
抽象方法
对象类型提示 函数声明中对参数进行对象类型提示,不正确系统报错
支持连续引用方法返回的对象 $obj->method()->method2();
迭代 实现Iterator接口后,可以用foreach()遍历一个类实例
__autoload()方法
其他特性
try/throw/catch 你只能抛出继承Exception的类
foreach 函数支持引用 循环参数加上&符号,可以在循环中更改数组的值
给引用参数设置默认值 php4只能给传递值的参数设置默认值,php5可以给传递引用的参数设置默认值
基础
php不支持全局变量,除了一些预定义的变量
间接引用
管理变量
isset() 用来判断某个变量是否已经被声明。返回布尔值
isset(v1,v2,v3…)可以接受多个参数,所有变量都定义的情况下才返回true
unset()取消定义之前的变量,如果没有其他变量引用它的话会释放变量使用的内存空间
empty() 判断变量是否没被声明或者值是false
预定义超全局变量
$_GET[],$_POST[],$_COOKIE[],$_ENV[],$_SERVER[]
基础数据类型
8种数据类型
整型
浮点型数字
字符串
单引号不支持双引号的转义和变量替换 定界符以<<<符号开始,紧跟的字符串不能在文本中出现。
定界符转义和变量替换基本和双引号相同,不同的是不需要转义双引号。
访问字符串中的字符 $str{1}
布尔型 空字符串("")和0("0")字符串为false
NULL
Resources
数组 php的数组是使用哈希表构建的。 array([key=>] value,[key=>] value,...) 方括号中元素可选
访问数组元素
$arr1[0]
使用foreach遍历数组
常量 define("CONSTANT_NAME",value [,case_sensitivity]) case_sensitivity大小写敏感,默认true
比较运算
1=="1" true
1==1 true
1==="1" false
1===1 true
类型转换
(int),(integer)
(float),(real),(double)
(string)
(bool),(Boolean)
(array)
(object)
代码包含控制结构
include file_name;
require file_name; require会停止代码执行,include只会警告
eval() 把代码当作字符串包含进来再执行
通过值返回数据
通过引用返回数据
传递值的参数
传递引用的参数
默认参数
2010年12月7日火曜日
OpenID OAuth 的区别
先来OpenID的
- 用户希望访问其在example.com的账户
- example.com (在OpenID的黑话里面被称为“Relying Party”) 提示用户输入他/她/它的OpenID
- 用户给出了他的OpenID,比如说"http://user.myopenid.com"
- example.com 跳转到了用户的OpenID提供商“mypopenid.com”
- 用户在"myopenid.com"(OpenID provider)提示的界面上输入用户名密码登录
- “myopenid.com" (OpenID provider) 问用户是否要登录到example.com
- 用户同意后,"myopenid.com" (OpenID provider) 跳转回example.com
- example.com 允许用户访问其帐号
再来OAuth的
- 用户在使用example.com时希望从mycontacts.com导入他的联系人
- example.com (在OAuth的黑话里面叫“Consumer”)把用户送往mycontacts.com (黑话是“Service Provider”)
- 用户在mycontacts.com 登录(可能也可能不用了他的OpenID)
- mycontacts.com问用户是不是希望授权example.com访问他在mycontact.com的联系人
- 用户确定
- mycontacts.com 把用户送回example.com
- example.com 从mycontacts.com拿到联系人
- example.com 告诉用户导入成功
上面的例子告诉我们,OpenID是用来验证的,就是说俺可以用一个url来唯一表明俺的身份(不用挨个记每个网站的用户密码了)。OAuth是用来授权的(俺可以授权一个网站访问俺在另外一个网站的数据,而俺不用把俺的密码给第一个网站。想想现在开心网让你通过msn联系人导入好有时候干的事儿吧,反正俺不愿意把俺的msn密码给开心网)
2010年12月4日土曜日
linux shell 笔记二
流程控制
if表达式
if...;then
...
elif...;then
...
else
...
fi
大多数情况下,可以使用测试命令来对条件进行测试。比如可以比较字符串、判断文件是否存在及是否可读等等…
通常用" [ ] "来表示条件测试。注意这里的空格很重要。要确保方括号的空格。
[ -f "somefile" ] :判断是否是一个文件
[ -x "/bin/ls" ] :判断/bin/ls是否存在并有可执行权限
[ -n "$var" ] :判断$var变量是否有值
[ "$a" = "$b" ] :判断$a和$b是否相等
条件判断:expression为字符串操作
-n str 字符串str是否不为空
-z str 字符串str是否为空
str1 =str2 str1是否与str2相同
str1!=str2 str1是否与str2不同
条件判断:expression为整数操作
expr1 -a expr2 如果 expr1 和 expr2 评估为真,则为真
expr1 -o expr2 如果 expr1 或 expr2 评估为真,则为真
条件判断:expression为bool操作
int1 -eq int2 如果int1等于int2,则为真
int1 -ge int2 如果int1大于或等于int2,则为真
int1 -gt int2 如果int1大于int2 ,则为真
int1 -le int2 如果int1小于或等于int2 ,则为真
int1 -lt int2 如果int1小于int2 ,则为真
int1 -ne int2 如果int1不等于int2 ,则为真
条件判断:expression为文件操作
-b 是否块文件 -p 文件是否为一个命名管道
-c 是否字符文件 -r 文件是否可读
-d 是否一个目录 -s 文件的长度是否不为零
-e 文件是否存在 -S 是否为套接字文件
-f 是否普通文件 -x 文件是否可执行,则为真
-g 是否设置了文件的 SGID 位 -u 是否设置了文件的 SUID 位
-G 文件是否存在且归该组所有 -w 文件是否可写,则为真
-k 文件是否设置了的粘贴位 -O 文件是否存在且归该用户所有
-t fd fd 是否是一个与终端相连的打开的文件描述符(fd 默认为 1)
-b file True if file exists and is a block special file.
-c file True if file exists and is a character special file.
-d file True if file exists and is a directory.
-e file True if file exists (regardless of type).
-f file True if file exists and is a regular file.
-g file True if file exists and its set group ID flag is set.
-h file True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this program. Do not rely on its existence; use -L instead.
-k file True if file exists and its sticky bit is set.
-p file True if file is a named pipe (FIFO).
-r file True if file exists and is readable.
-s file True if file exists and has a size greater than zero.
-t file_descriptor True if the file whose file descriptor number is file_descriptor is open and is associated with a terminal.
-u file True if file exists and its set user ID flag is set.
-w file True if file exists and is writable. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true.
-x file True if file exists and is executable. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched.
-L file True if file exists and is a symbolic link.
-O file True if file exists and its owner matches the effective user id of this process.
-G file True if file exists and its group matches the effective group id of this process.
-S file True if file exists and is a socket.
-z string True if the length of string is zero.
-n string True if the length of string is nonzero.
file1 -nt file2 True if file1 exists and is newer than file2.
file1 -ot file2 True if file1 exists and is older than file2.
file1 -ef file2 True if file1 and file2 exist and refer to the same file.
string True if string is not the null string.
s1 = s2 True if the strings s1 and s2 are identical.
s1 != s2 True if the strings s1 and s2 are not identical.
s1 < s2 True if string s1 comes before s2 based on the ASCII value of their characters.
s1 > s2 True if string s1 comes after s2 based on the ASCII value of their characters.
n1 -eq n2 True if the integers n1 and n2 are algebraically equal.
n1 -ne n2 True if the integers n1 and n2 are not algebraically equal.
n1 -gt n2 True if the integer n1 is algebraically greater than the integer n2.
n1 -ge n2 True if the integer n1 is algebraically greater than or equal to the integer n2.
n1 -lt n2 True if the integer n1 is algebraically less than the integer n2.
n1 -le n2 True if the integer n1 is algebraically less than or equal to the integer n2.
if表达式
if...;then
...
elif...;then
...
else
...
fi
大多数情况下,可以使用测试命令来对条件进行测试。比如可以比较字符串、判断文件是否存在及是否可读等等…
通常用" [ ] "来表示条件测试。注意这里的空格很重要。要确保方括号的空格。
[ -f "somefile" ] :判断是否是一个文件
[ -x "/bin/ls" ] :判断/bin/ls是否存在并有可执行权限
[ -n "$var" ] :判断$var变量是否有值
[ "$a" = "$b" ] :判断$a和$b是否相等
条件判断:expression为字符串操作
-n str 字符串str是否不为空
-z str 字符串str是否为空
str1 =str2 str1是否与str2相同
str1!=str2 str1是否与str2不同
条件判断:expression为整数操作
expr1 -a expr2 如果 expr1 和 expr2 评估为真,则为真
expr1 -o expr2 如果 expr1 或 expr2 评估为真,则为真
条件判断:expression为bool操作
int1 -eq int2 如果int1等于int2,则为真
int1 -ge int2 如果int1大于或等于int2,则为真
int1 -gt int2 如果int1大于int2 ,则为真
int1 -le int2 如果int1小于或等于int2 ,则为真
int1 -lt int2 如果int1小于int2 ,则为真
int1 -ne int2 如果int1不等于int2 ,则为真
条件判断:expression为文件操作
-b 是否块文件 -p 文件是否为一个命名管道
-c 是否字符文件 -r 文件是否可读
-d 是否一个目录 -s 文件的长度是否不为零
-e 文件是否存在 -S 是否为套接字文件
-f 是否普通文件 -x 文件是否可执行,则为真
-g 是否设置了文件的 SGID 位 -u 是否设置了文件的 SUID 位
-G 文件是否存在且归该组所有 -w 文件是否可写,则为真
-k 文件是否设置了的粘贴位 -O 文件是否存在且归该用户所有
-t fd fd 是否是一个与终端相连的打开的文件描述符(fd 默认为 1)
-b file True if file exists and is a block special file.
-c file True if file exists and is a character special file.
-d file True if file exists and is a directory.
-e file True if file exists (regardless of type).
-f file True if file exists and is a regular file.
-g file True if file exists and its set group ID flag is set.
-h file True if file exists and is a symbolic link. This operator is retained for compatibility with previous versions of this program. Do not rely on its existence; use -L instead.
-k file True if file exists and its sticky bit is set.
-p file True if file is a named pipe (FIFO).
-r file True if file exists and is readable.
-s file True if file exists and has a size greater than zero.
-t file_descriptor True if the file whose file descriptor number is file_descriptor is open and is associated with a terminal.
-u file True if file exists and its set user ID flag is set.
-w file True if file exists and is writable. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true.
-x file True if file exists and is executable. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched.
-L file True if file exists and is a symbolic link.
-O file True if file exists and its owner matches the effective user id of this process.
-G file True if file exists and its group matches the effective group id of this process.
-S file True if file exists and is a socket.
-z string True if the length of string is zero.
-n string True if the length of string is nonzero.
file1 -nt file2 True if file1 exists and is newer than file2.
file1 -ot file2 True if file1 exists and is older than file2.
file1 -ef file2 True if file1 and file2 exist and refer to the same file.
string True if string is not the null string.
s1 = s2 True if the strings s1 and s2 are identical.
s1 != s2 True if the strings s1 and s2 are not identical.
s1 < s2 True if string s1 comes before s2 based on the ASCII value of their characters.
s1 > s2 True if string s1 comes after s2 based on the ASCII value of their characters.
n1 -eq n2 True if the integers n1 and n2 are algebraically equal.
n1 -ne n2 True if the integers n1 and n2 are not algebraically equal.
n1 -gt n2 True if the integer n1 is algebraically greater than the integer n2.
n1 -ge n2 True if the integer n1 is algebraically greater than or equal to the integer n2.
n1 -lt n2 True if the integer n1 is algebraically less than the integer n2.
n1 -le n2 True if the integer n1 is algebraically less than or equal to the integer n2.
! expression True if expression is false.
expression1 -a expression2 True if both expression1 and expression2 are true.
expression1 -o expression2 True if either expression1 or expression2 are true.
(expression) True if expression is true.
linux shell 笔记一
1 开头
#!/bin/sh
2.1 环境变量
由export关键字处理过的变量叫做环境变量。
2.3 系统变量
$1,$2
$*
1> 正常输出
2> 错误输出
& 后台执行
/dev/null
2.4 常用系统变量
$n $1 表示第一个参数,$2 表示第二个参数 ...
$# 命令行参数的个数
$0 当前程序的名称
$? 前一个命令或函数的返回码
$* 以"参数1 参数2 ... " 形式保存所有参数
$@ 以"参数1" "参数2" ... 形式保存所有参数
$$ 本程序的(进程ID号)PID
$! 上一个命令的PID
3 Unix 命令
#!/bin/sh
符号#!用来告诉系统它后面的参数是用来执行该文件的程序。在这个例子中我们使用/bin/sh来执行程序。
当编辑好脚本时,如果要执行该脚本,还必须使其可执行。
要使脚本可执行:
编译 chmod +x filename 这样才能用./filename 来运行
要使脚本可执行:
编译 chmod +x filename 这样才能用./filename 来运行
2 变量
#对变量赋值:
a="hello world"#对变量赋值:
2.1 环境变量
由export关键字处理过的变量叫做环境变量。
2.3 系统变量
$1,$2
$*
1> 正常输出
2> 错误输出
& 后台执行
/dev/null
2.4 常用系统变量
$n $1 表示第一个参数,$2 表示第二个参数 ...
$# 命令行参数的个数
$0 当前程序的名称
$? 前一个命令或函数的返回码
$* 以"参数1 参数2 ... " 形式保存所有参数
$@ 以"参数1" "参数2" ... 形式保存所有参数
$$ 本程序的(进程ID号)PID
$! 上一个命令的PID
3 Unix 命令
虽然在shell脚本中可以使用任意的unix命令,但是还是由一些相对更常用的命令。这些命令通常是用来进行文件和文字操作的。
cut -b colnum file: 指定欲显示的文件内容范围,并将它们输出到标准输出设备。比如:输出每行第5个到第9个字符cut -b5-9 file.txt
file somefile: 得到文件类型
cut -b colnum file: 指定欲显示的文件内容范围,并将它们输出到标准输出设备。比如:输出每行第5个到第9个字符cut -b5-9 file.txt
file somefile: 得到文件类型
read var: 提示用户输入,并将输入赋值给变量
sort file.txt: 对file.txt文件中的行进行排序
uniq: 删除文本文件中出现的行列比如:
sort file.txt | uniq
sort file.txt | uniq
expr: 进行数学运算Example:
add 2 and 3expr 2 "+" 3
add 2 and 3expr 2 "+" 3
find: 搜索文件比如:根据文件名搜索
find . -name filename -print
find . -name filename -print
tee: 将数据输出到标准输出设备(屏幕) 和文件比如:
somecommand | tee outfile
somecommand | tee outfile
basename file: 返回不包含路径的文件名比如:
basename /bin/tux将返回 tux
basename /bin/tux将返回 tux
dirname file: 返回文件所在路径比如:
dirname /bin/tux将返回 /bin
dirname /bin/tux将返回 /bin
head file: 打印文本文件开头几行
tail file : 打印文本文件末尾几行
sed: Sed是一个基本的查找替换程序。可以从标准输入(比如命令管道)读入文本,并将结果输出到标准输出(屏幕)。该命令采用正则表达式(见参考)进行搜索。
awk: awk 用来从文本文件中提取字段。缺省地,字段分割符是空格,可以使用-F指定其他分割符。
cat file.txt | awk -F, '{print $1 "," $3 }'
这里我们使用,作为字段分割符,同时打印第一个和第三个字段。
cat file.txt | awk -F, '{print $1 "," $3 }'
这里我们使用,作为字段分割符,同时打印第一个和第三个字段。
4 管道
管道 (|) 将一个命令的输出作为另外一个命令的输入。
管道 (|) 将一个命令的输出作为另外一个命令的输入。
grep "hello" file.txt | wc -l 在file.txt中搜索包含有”hello”的行并计算其行数。
5 重定向
将命令的结果输出到文件,而不是标准输出(屏幕)。
将命令的结果输出到文件,而不是标准输出(屏幕)。
> 写入文件并覆盖旧文件
>> 加到文件的尾部,保留旧文件内容。
6 反短斜线
用来查找过去24小时(-mtime –2则表示过去48小时)内修改过的文件。如果想将所有查找到的文件打一个包,则可以使用以下脚本:
tar -zcvf lastmod.tar.gz `find . -mtime -1 -type f -print`
用来查找过去24小时(-mtime –2则表示过去48小时)内修改过的文件。如果想将所有查找到的文件打一个包,则可以使用以下脚本:
tar -zcvf lastmod.tar.gz `find . -mtime -1 -type f -print`
2010年12月2日木曜日
find -mtime +1 find -mtime -1
所有文件都有3个时间信息,保存在文件系统中
atime是文件最后一此读的时间
mtime是文件最后一次写的时间
ctime是i-node信息最后一次写的时间.
[root@netsky test]# date
Thu Feb 12 23:26:41 CST 2009
[root@netsky test]# ll
total 0
-rw-r--r-- 1 root root 0 Feb 10 10:00 1
-rw-r--r-- 1 root root 0 Feb 10 10:00 2
-rw-r--r-- 1 root root 0 Feb 11 10:00 3
-rw-r--r-- 1 root root 0 Feb 11 10:00 4
-rw-r--r-- 1 root root 0 Feb 12 23:21 5
-rw-r--r-- 1 root root 0 Feb 12 23:21 6
-rw-r--r-- 1 root root 0 Feb 13 2009 7
-rw-r--r-- 1 root root 0 Feb 13 2009 8
[root@netsky test]# find . -mtime +1
./2
./1
[root@netsky test]# find . -mtime 1
./3
./4
[root@netsky test]# find . -mtime -1
.
./5
./7
./8
./6
[/code]
[root@netsky test]# find . -mtime +0
./2
./1
./3
./4
[root@netsky test]# find . -mtime -0
./7
./8
[root@netsky test]# find . -mtime 0
.
./5
./6
atime是文件最后一此读的时间
mtime是文件最后一次写的时间
ctime是i-node信息最后一次写的时间.
[root@netsky test]# date
Thu Feb 12 23:26:41 CST 2009
[root@netsky test]# ll
total 0
-rw-r--r-- 1 root root 0 Feb 10 10:00 1
-rw-r--r-- 1 root root 0 Feb 10 10:00 2
-rw-r--r-- 1 root root 0 Feb 11 10:00 3
-rw-r--r-- 1 root root 0 Feb 11 10:00 4
-rw-r--r-- 1 root root 0 Feb 12 23:21 5
-rw-r--r-- 1 root root 0 Feb 12 23:21 6
-rw-r--r-- 1 root root 0 Feb 13 2009 7
-rw-r--r-- 1 root root 0 Feb 13 2009 8
[root@netsky test]# find . -mtime +1
./2
./1
[root@netsky test]# find . -mtime 1
./3
./4
[root@netsky test]# find . -mtime -1
.
./5
./7
./8
./6
[/code]
[root@netsky test]# find . -mtime +0
./2
./1
./3
./4
[root@netsky test]# find . -mtime -0
./7
./8
[root@netsky test]# find . -mtime 0
.
./5
./6
登録:
投稿 (Atom)