Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script

错误一:

joe@Joe-PC:/usr/local/yaf-2.3.2$ sudo phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

错误二:

joe@Joe-PC:/usr/local/php-5.5.5/bin$ sudo pecl install yaf
downloading yaf-2.2.9.tgz ...
Starting to download yaf-2.2.9.tgz (95,034 bytes)
.....................done: 95,034 bytes
56 source files, building
WARNING: php_bin /usr/local/php-5.5.5/bin/php appears to have a suffix -5.5.5/bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

以上两处报错解的决办法:
下载如下两个软件然后分别解压安装

sudo wget http://ftp.gnu.org/gnu/m4/m4-1.4.tar.gz
sudo tar zxvf m4-1.4.tar.gz
cd m4-1.4/
sudo ./configure && sudo make && sudo make install

sudo wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
sudo tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69/
sudo ./configure && sudo make && sudo make install

php抓取人人网内容,php爬取人人网用户数据,模拟浏览器抓取内容,curl抓取与html分析

项目位置 http://git.oschina.net/thendfeel/xxtime
人人网的用户数据很真实全面,比新浪微博的靠谱多了
所以就想起写一个抓取人人网数据的程序

本例中用到的3个文件
1.simple_html_dom.php 是国际友人写的一个html分析类文件
2.Jcurl.php 是我闲来无事写的一个模拟浏览器访问的类文件,没什么技术含量,其实就是curl
3.DataSource.html 人人网真实数据抓取保存下来的网页

本例中可以使用在线人人真实的网址替换掉DataSource.html,但需要设置cookie,因为不登陆不会让你抓取的,cookie请自行抓包获取

程序如下

<?php
/**
* 人人数据爬取分析
* 本程序可根据cookie爬取人人网用户信息
* 本例使用simple_html_dom.php作为html分析程序, 以DataSource.html文件为目标源文件
*
* @package xxtime/Simple/Jcrawler_renren.php
* @author joe@xxtime.com
* @link https://github.com/thendfeel/xxtime
* @example http://dev.xxtime.com
* @copyright xxtime.com
* @created 2014-02-25
*/
include '../simple_html_dom.php';
include '../Jcurl.php';
Jcurl::$cookie = 'anonymid=hqhua3nr-jbl05x; _r01_=1; JSESSIONID=abc-whI8Y7-UEdaQlnVqu; _urm_229165395=175935; timestamp=1392363322410; sign=2B4E0568DFB79B57307553544193ECBB; orignalSign=10a86cff6ad8895f07311796d9561073app_key12614735timestamp139236332241010a86cff6ad8895f07311796d9561073; depovince=GW; jebe_key=33c9afc4-38cd-494e-bd85-8287e2a80f89%7Cc4e0ea06c7f9f2bc5879e7a55a15104e%7C1393229670408%7C1; XNESSESSIONID=3f245656a8f1; ick_login=5d343dab-ba1d-4df7-920b-83de4ede785d; ick=2acb2169-fe6c-4e7c-8337-2e35b351b1c6; jebecookies=b9f8444e-f687-4584-b7fb-a83066c85541|||||; _de=52D969BB6AA78EF7CDC3323DFA47FB42; p=54c3d3ac5c6cddce191c761389a475515; t=f68dc9393363c26f9a9548a8a5d8750a5; societyguester=f68dc9393363c26f9a9548a8a5d8750a5; id=229165395; xnsid=97ee616f; loginfrom=null; feedType=229165395_hot';
$url = 'http://www.renren.com/238209939/profile?v=info_ajax';
// 本例用本地源文件,如抓取人人网线上数据请 修改cookie值和$url,即Jcurl::$cookie和$url,其中cookie自己抓包获取
// $output = Jcurl::get($url); // 用线上数据则取消注释本行
// $html = str_get_html($output); // 用线上数据则取消注释本行
$html = file_get_html('DataSource.html');	// 用线上数据则注释掉本行
$input['plat'] = 'renren';
$input['uid'] = $html->find('input#fromno', 0)->value;
$input['name'] = $input['uid'];
$input['gender'] = $html->find('div#basicInfo dd', 0)->plaintext;
$input['realname'] = $html->find('input#title', 0)->value;
$input['age'] = date('Y') - $html->find('div#basicInfo dd a', 0)->plaintext;
$input['birthday'] = $html->find('div#basicInfo dd a', 0)->plaintext.'-' .$html->find('div#basicInfo dd a', 1)->plaintext.'-'.$html->find('div#basicInfo dd a', 2)->plaintext;
$input['qq'] = $html->find('dl#profile_info dd', 0)->plaintext;
$input['mobile'] = $html->find('dl#profile_info dd', 2)->plaintext;
$input['email'] = '';
$input['site'] = $html->find('dl#profile_info a', 0)->href;
$input['photo'] = $html->find('img#userpic', 0)->src;
$input['hometown'] = $html->find('div#basicInfo dd a', 4)->plaintext .' '. $html->find('div#basicInfo dd a', 5)->plaintext;
$input['college'] = $html->find('div#educationInfo dd a', 0)->plaintext;
$input['interest'] = $html->find('td.userProfileItemValue a', 0)->plaintext;
Jcurl::writeFile($input['name'], 'result.txt');
print_r($input);

参考http://git.oschina.net/thendfeel/xxtime/blob/master/example/Jcrawler_renren_shd.php

yii快速创建项目,yii demo, Yii nginx 重写配置, yii url重写

yii使用说明详见:
http://www.yiichina.com/guide/quickstart.first-app

在YII根目录中创建名为 demoapp 的应用,与framework同级

php framework/yiic.php webapp demoapp

然后访问
http://hostname/demoapp/index.php

Yii nginx 重写配置, yii url重写

if (!-e $request_filename) {
	rewrite ^/(.*) /index.php?r=$1 last;
}

经过配置后 下面的两个url就都能访问且等同
http://yii.xxtime.com/index.php?r=manageUser/create
http://yii.xxtime.com/manageUser/create

编辑配置文件 项目更目录/protected/config/main.php
去掉urlManager的注释,然后修改如下

'urlManager'=>array(
	'urlFormat'=>'path',
	'showScriptName'=>FALSE,
	'rules'=>array(
		'<controller:w+>/<id:d+>'=>'<controller>/view',
		'<controller:w+>/<action:w+>/<id:d+>'=>'<controller>/<action>',
		'<controller:w+>/<action:w+>'=>'<controller>/<action>',
	),
),

更多参考见 http://wiki.nginx.org/Yii