TIPI
TIPI:PHP
www.php-internal.com RELEASE_2011-07-29_V0.6.7
reeze http://reeze.cn
er http://www.zhangabc.com
phppan http://www.phppan.com
TIPI:PHP RELEASE_2011-07-29_V0.6.7
TIPI:PHP RELEASE_2011-07-29_V0.6.7
PHPPHP
PHP PHP
*nixWindows PHP
PHPPHP PHP PHP
PHPPHPPHPPHP
PHP6
PHP *nix
PHP
(*nixUnixLinuxFreeBSD OpenSolaris Mac OS X
)
1.PHP
PHPPHPPHP
http://php.net/downloads.php svn/gitsvn/git
#svn
cd ~
svn co http://svn.php.net/repository/php/php-src/branches/PHP_5_2 php-src-5.2
#5.2
svn co http://svn.php.net/repository/php/php-src/branches/PHP_5_3 php-src-5.3
#5.3
#git
cd ~
git clone git://github.com/php/php-src.git php-src
PHP
()
PHPSVNgit
svngit
git
(DVCS) PythonDVCS
TIPI:PHP RELEASE_2011-07-29_V0.6.7
2.
*nixUbuntuapt
sudo apt-get install build-essential
Mac OSXcodeXcodeMac OS X
Apple ID http://developer.apple.com/
3.
ApachePHPMysql
svn/git
buildconf
cd ~/php-src
./buildconf
configureconfigure
./configure --help #
PHP ./configure --disable-all
configurePHP
configureconfigure
./configure --disable-all
make
*nixconfigure makemake installmake
make install installconfigureprefix
PHP make sapi/cliphp
.
./sapi/cli/php -n -v
-nphp.ini-vphp
make install$prefix/bin/phpphp
prefix$PATHphp
makemake install
makemake install
TIPI:PHP RELEASE_2011-07-29_V0.6.7
php-cliphp-src/sapi/cli/php
configure make make && make install
linuxsir.orgmake http://www.linuxsir.org/main/doc/gnumake/GNUmake_v3.80-
zh_CN_html/index.html
Autotools A Practioner's Guide
PHP
PHPPHP
: /
README
/README.PHP4-TO-PHP5-THIN-CHANGES PHP4PHP5
/CODING_STANDARDSPHP
build buildconf
ext PHParraypdospl
main PHPPHPZend
Zend
Zend Zendopcode
pear “PHP ”PEAR
sapi apachemod_phpcgifastcgifpm
TSRM PHPTSRMPHP*GTSRM
TSRM(Thread Safe Resource Manager)
tests PHPPHP
win32 WindowssokcetWindows*Nix
WindowsPHP
PHPPHPPHPphp/run-testsphp
testsphpt php
/tests/basic/001phpt
TIPI:PHP RELEASE_2011-07-29_V0.6.7
--TEST--
Trivial "Hello World" test
--FILE--
--EXPECT--
Hello World
--FILE--PHP--EXPECT--
Fatal Error
php
system()exec()
phpproc_open()
PHP
VIM + Ctags
Linux*NixVIM
Emacs
Emacs
Linuxctags ctags
:
VIMEMACS UNIX
#PHP(/server/php-src):
$ cd /server/php-src
$ ctags -R
#tags
# ctags -R /server/ ctags
#~/.vimrc:
set tags+=/server/php-src/tags
#vim:
:set tags+=/server/php-src/tags
/sever/php-srctags
{tagname}{tagfile}{tagaddress}
EG Zend/zend_globals_macros.h /^# define EG(/;" d
EG
VIMtagsCTRL+]
VIMtags
TIPI:PHP RELEASE_2011-07-29_V0.6.7
Ctrl+] Ctrl+t
“”
VIM
IDE
Mac OS XctagsMac OS Xctags
ctagshomebrew
IDE
VIMIDEWindowsVisual
Studio 2010 Express NetbeansEclipse
EclipseNetbeansCTRL
VS win32
Win32 Console Application
F12
CTRL + F12
F3:
Shift+F3:
Ctrl+G:
CTRL + -
CTRL + SHIFT + -
Editplus
Editplus ...
PHP
PHP
1. "##""#"
C/C++
PHP "##""#"
TIPI:PHP RELEASE_2011-07-29_V0.6.7
(##)
C"##" concatenator
(Token)
#define PHP_FUNCTION ZEND_FUNCTION
#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(ZEND_FN(name))
#define ZEND_FN(name) zif_##name
#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval
**return_value_ptr, \
zval *this_ptr, int return_value_used TSRMLS_DC
PHP_FUNCTION(count);
// PHP_FUCNTION(count);
void zif_count(int ht, zval *return_value, zval **return_value_ptr,
zval *this_ptr, int return_value_used TSRMLS_DC)
ZEND_FN(name)"##"zifname
(#)
"#"
(Token)
:
#define STR(x) #x
int main(int argc char** argv)
{
printf("%s\n", STR(It's a long string)); // It's a long str
return 0;
}
It's a long string STRprintf
2. do-while
PHPPHP5.3