ubuntu下编写php的c扩展例子
1.安装lamp环境
sudo apt-get install apache2 php5 mysql
2.获取php源码
sudo apt-get install dpkg-dev
sudo apt-get source php5
3.编译步骤
cd /path/ext/
./ext_skel –extname=helloword
cd helloword/
vim config.m4
vim php_helloword.h
vim helloword.c
phpize
./configure –with-php-config=/usr/bin/php-config
make
make install
4.应用扩展,重启apache
vim /etc/php5/apache2/php.ini 设置 extensions=
/etc/init.d/apache2 restart