PHP 真正多线程的使用
2015/05/26 08:12 | by admin ]
我之前的文章中说过,大多数网站的性能瓶颈不在PHP服务器上,因为它可以简单地通过横向增加服务器或CPU核数来轻松应对(对于各种云主机,增加VPS或CPU核数就更方便了,直接以备份镜像增加VPS,连操作系统、环境都不用安装配置),而是在于MySQL数据库。如果用 MySQL 数据库,一条联合查询的SQL,也许就可以处理完业务逻辑,但是,遇到大量并发请求,就歇菜了。如果用 NoSQL 数据库,也许需要十次查询,才能处理完同样地业务逻辑,但每次查询都比 MySQL 要快,十次循环NoSQL查询也许比一次MySQL联合查询更快,应对几万次/秒的查询完全没问题。如果加上PHP多线程,通过十个线程同时查询NoSQL,返回结果汇总输出,速度就要更快了。我们实际的APP产品中,调用一个通过用户喜好实时推荐商品的PHP接口,PHP需要对BigSea NoSQL数据库发起500~1000次查询,来实时算出用户的个性喜好商品数据,PHP多线程的作用非常明显。
PHP扩展下载:https://github.com/krakjoe/pthreads
PHP手册文档:http://php.net/manual/zh/book.pthreads.php
1、扩展的编译安装(Linux),编辑参数 --enable-maintainer-zts 是必选项:
./configure --prefix=/Data/apps/php --with-config-file-path=/Data/apps/php/etc --with-mysql=/Data/apps/mysql --with-mysqli=/Data/apps/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/Data/apps/libs --with-jpeg-dir=/Data/apps/libs --with-png-dir=/Data/apps/libs --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/Data/apps/libs --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts
make clean
make
make install
unzip pthreads-master.zip
cd pthreads-master
/Data/apps/php/bin/phpize
./configure --with-php-config=/Data/apps/php/bin/php-config
make
make install
添加:
2、给出一段PHP多线程、与For循环,抓取百度搜索页面的PHP代码示例:
- <?php
- class test_thread_run extends Thread
- {
- public $url;
- public $data;
- public function __construct($url)
- {
- $this->url = $url;
- }
- public function run()
- {
- if(($url = $this->url))
- {
- $this->data = model_http_curl_get($url);
- }
- }
- }
- function model_thread_result_get($urls_array)
- {
- foreach ($urls_array as $key => $value)
- {
- $thread_array[$key] = new test_thread_run($value["url"]);
- $thread_array[$key]->start();
- }
- foreach ($thread_array as $thread_array_key => $thread_array_value)
- {
- while($thread_array[$thread_array_key]->isRunning())
- {
- usleep(10);
- }
- if($thread_array[$thread_array_key]->join())
- {
- $variable_data[$thread_array_key] = $thread_array[$thread_array_key]->data;
- }
- }
- return $variable_data;
- }
- function model_http_curl_get($url,$userAgent="")
- {
- $userAgent = $userAgent ? $userAgent : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)';
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_TIMEOUT, 5);
- curl_setopt($curl, CURLOPT_USERAGENT, $userAgent);
- $result = curl_exec($curl);
- curl_close($curl);
- return $result;
- }
- for ($i=0; $i < 100; $i++)
- {
- $urls_array[] = array("name" => "baidu", "url" => "http://www.baidu.com/s?wd=".mt_rand(10000,20000));
- }
- $t = microtime(true);
- $result = model_thread_result_get($urls_array);
- $e = microtime(true);
- echo "多线程:".($e-$t)."\n";
- $t = microtime(true);
- foreach ($urls_array as $key => $value)
- {
- $result_new[$key] = model_http_curl_get($value["url"]);
- }
- $e = microtime(true);
- echo "For循环:".($e-$t)."\n";
- ?>
为 MySQL 增加 HTTP/REST 客户端:MySQL UDF 函数 mysql-udf-http 1.0 发布
2015/05/26 08:09 | by admin ]
Mysql-udf-http 是一款简单的MySQL用户自定义函数(UDF, User-Defined Functions),具有http_get()、http_post()、http_put()、http_delete()四个函数,可以在MySQL数据库中利用HTTP协议进行REST相关操作。
项目网址:http://code.google.com/p/mysql-udf-http/
中文说明:http://blog.zyan.cc/mysql-udf-http/
使用环境:Linux操作系统,支持的MySQL版本:5.1.x 和 5.5.x。5.0.x未经测试。
软件作者:张宴
一、REST架构风格:
REST(Representational State Transfer)是一种轻量级的Web Service架构风格,其实现和操作明显比SOAP和XML-RPC更为简洁,可以完全通过HTTP协议实现,还可以利用缓存Cache来提高响应速度,性能、效率和易用性上都优于SOAP协议。REST最早是由 Roy Thomas Fielding 博士2000年在论文《Architectural Styles and the Design of Network-based Software Architectures》中提出的,中文译文全文PDF点此下载。另外,有篇译文对REST做了一个简化说明。
目前,REST架构风格的常见实现是基于HTTP协议及其四种基本方法(如POST、GET、PUT和DELETE)的。有人将HTTP协议的四种方法与CRUD原则相对应,CRUD原则对于资源只需要四种行为:Create(创建)、Read(读取)、Update(更新)和Delete(删除)就可以完成对其操作和处理。


在Mysql-udf-http中,四个函数http_post()、http_get()、http_put()、http_delete()分别对应HTTP协议的POST、GET、PUT、DELETE四种方法。
REST是一种架构风格,而不是协议或标准。HTTP协议“POST、GET、PUT、DELET”四种方法与CRUD原则“Create、Read、Update、Delete”四种行为的一一对应关系只是一种架构设计习惯,而不是规范。因此,POST方法也可以用来更新资源,PUT方法也可以用来创建资源,这就要看具体应用程序作者的定义了。例如Tokyo Tyrant除了支持Memcached协议外,还支持REST方式存取,PUT代表创建和更新,GET代表读取,DELETE代表删除(关于Tokyo Tyrant的安装使用请点击这儿)。
目前国内外流行的Web 2.0应用API接口中,很多都支持REST架构风格。例如:新浪微博开放平台、人人网API、Google OpenID、Flickr、Twitter、eBay、Facebook、Last.fm、del.icio.us、Yahoo Search、Amazon S3、Amazon EC2、Digg、Microsoft Bing、FriendFeed、PayPal、Foursquare,更多...
当记录数成百上千万条时,通常采用 MySQL 分表减低数据库压力。但是,全部数据按点击数、精华、积分排序显示等功能,在MySQL 分表中则无法实现。编写 Mysql-udf-http 的最初目的,是为了在项目开发中,将 MySQL 各分表的数据自动同步到我们的 TCSQL 高速列表数据库,用来做列表查询、显示,内容页则根据ID直接查询各 MySQL 分表的内容。由于HTTP协议的通用性,通过 Mysql-udf-http 可以做更多的事情。
通过Mysql-udf-http,你可以在MySQL中利用触发器,将MySQL的数据同步到支持REST的应用上。例如你有一个独立博客,你可以在文章表创建MySQL触发器,这样,在发表文章时,就可以将文章标题、URL自动同步到新浪微博、Twitter。你想用 Tokyo Tyrant 做缓存,也可以利用MySQL触发器在发生增、删、改时,将数据自动同步到 Tokyo Tyrant。详细配置方法本文第4节中会有介绍。
二、Mysql-udf-http的安装与使用:
1. 在Linux系统上安装Mysql-udf-http
注意:“/usr/local/webserver/mysql/”是你的MySQL安装路径,如果你的MySQL安装路径不同,请自行修改。
wget http://curl.haxx.se/download/curl-7.21.1.tar.gz
tar zxvf curl-7.21.1.tar.gz
cd curl-7.21.1/
./configure --prefix=/usr
make && make install
cd ../
echo "/usr/local/webserver/mysql/lib/mysql/" > /etc/ld.so.conf.d/mysql.conf
/sbin/ldconfig
wget http://mysql-udf-http.googlecode.com/files/mysql-udf-http-1.0.tar.gz
tar zxvf mysql-udf-http-1.0.tar.gz
cd mysql-udf-http-1.0/
./configure --prefix=/usr/local/webserver/mysql --with-mysql=/usr/local/webserver/mysql/bin/mysql_config
make && make install
cd ../
2. 通过命令行登陆进入MySQL
3. 创建MySQL自定义函数
mysql>
- create function http_get returns string soname 'mysql-udf-http.so';
- create function http_post returns string soname 'mysql-udf-http.so';
- create function http_put returns string soname 'mysql-udf-http.so';
- create function http_delete returns string soname 'mysql-udf-http.so';
4. 使用方法
I. 函数描述:
mysql>
- SELECT http_get('<url>');
- SELECT http_post('<url>', '<data>');
- SELECT http_put('<url>', '<data>');
- SELECT http_delete('<url>');
II. 示例 A:
mysql>
- /* HTTP GET、POST方式提交关键词“xoyo”到百度移动搜索 */
- SELECT http_get('http://m.baidu.com/s?word=xoyo&pn=0');
- SELECT http_post('http://m.baidu.com/s','word=xoyo&pn=0');
- /* 新浪微博开放平台:获取新浪用户ID为103500的最近一条微博内容 */
- SELECT http_get('http://api.t.sina.com.cn/statuses/user_timeline/103500.json?count=1&source=1561596835') AS data;
- /* 新浪微博开放平台:发表一条微博 */
- SELECT http_post('http://your_sina_uid:your_password@api.t.sina.com.cn/statuses/update.xml?source=1561596835', 'status=Thins is sina weibo test information');
- /* Tokyo Tyrant 写入、读取、删除操作 */
- SELECT http_put('http://192.168.8.34:1978/key', 'This is value');
- SELECT http_get('http://192.168.8.34:1978/key');
- SELECT http_delete('http://192.168.8.34:1978/key');
III. 示例
通过MySQL触发器,利用mysql-udf-http和第三方UDF函数lib_mysqludf_json,自动同步数据到 Tokyo Tyrant。
(1). 下载安装 lib_mysqludf_json 修改版:
以下安装包适合32位Linux操作系统:
tar zxvf lib_mysqludf_json-i386.tar.gz
cd lib_mysqludf_json-i386/
# 如果你的MySQL安装路径不是/usr/local/webserver/mysql/,请修改以下路径。
cp -f lib_mysqludf_json.so /usr/local/webserver/mysql/lib/mysql/plugin/lib_mysqludf_json.so
cd ../
以下安装包适合64位Linux操作系统:
tar zxvf lib_mysqludf_json-x86_64.tar.gz
cd lib_mysqludf_json-x86_64/
# 如果你的MySQL安装路径不是/usr/local/webserver/mysql/,请修改以下路径。
cp -f lib_mysqludf_json.so /usr/local/webserver/mysql/lib/mysql/plugin/lib_mysqludf_json.so
cd ../
通过命令行登陆进入MySQL:
mysql>
- create function lib_mysqludf_json_info returns string soname 'lib_mysqludf_json.so';
- create function json_array returns string soname 'lib_mysqludf_json.so';
- create function json_members returns string soname 'lib_mysqludf_json.so';
- create function json_object returns string soname 'lib_mysqludf_json.so';
- create function json_values returns string soname 'lib_mysqludf_json.so';
(2). 创建测试表
mysql>
- SET NAMES UTF8;
- USE test;
- CREATE TABLE IF NOT EXISTS `mytable` (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `addtime` int(10) NOT NULL,
- `title` varchar(255) CHARACTER SET utf8 NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
(3). 为测试表创建触发器:
mysql>
- /* INSERT插入操作的触发器 */
- DELIMITER |
- DROP TRIGGER IF EXISTS mytable_insert;
- CREATE TRIGGER mytable_insert
- AFTER INSERT ON mytable
- FOR EACH ROW BEGIN
- SET @tt_json = (SELECT json_object(id,addtime,title) FROM mytable WHERE id = NEW.id LIMIT 1);
- SET @tt_resu = (SELECT http_put(CONCAT('http://192.168.8.34:1978/', NEW.id), @tt_json));
- END |
- DELIMITER ;
- /* UPDATE更新操作的触发器 */
- DELIMITER |
- DROP TRIGGER IF EXISTS mytable_update;
- CREATE TRIGGER mytable_update
- AFTER UPDATE ON mytable
- FOR EACH ROW BEGIN
- SET @tt_json = (SELECT json_object(id,addtime,title) FROM mytable WHERE id = OLD.id LIMIT 1);
- SET @tt_resu = (SELECT http_put(CONCAT('http://192.168.8.34:1978/', OLD.id), @tt_json));
- END |
- DELIMITER ;
- /* DELETE删除操作的触发器 */
- DELIMITER |
- DROP TRIGGER IF EXISTS mytable_delete;
- CREATE TRIGGER mytable_delete
- AFTER DELETE ON mytable
- FOR EACH ROW BEGIN
- SET @tt_resu = (SELECT http_delete(CONCAT('http://192.168.8.34:1978/', OLD.id)));
- END |
- DELIMITER ;
(4). 将 MySQL 表和 Tokyo Tyrant 关联进行查询:
mysql>
- SELECT id,addtime,title,http_get(CONCAT('http://192.168.8.34:1978/',id)) AS tt FROM mytable ORDER BY id DESC LIMIT 0,5;
5. 如何删除mysql-udf-http UDF函数:
mysql>
- drop function http_get;
- drop function http_post;
- drop function http_put;
- drop function http_delete;
HTTPSQS 1.7 发布:Libevent 2.0.x 的 evhttp_parse_query BUG 与动态编译时指定动态链接库 .so 寻找路径
2015/05/26 08:08 | by admin ]
HTTPSQS(HTTP Simple Queue Service)是一款基于 HTTP GET/POST 协议的轻量级开源简单消息队列服务,使用 Tokyo Cabinet 的 B+Tree Key/Value 数据库来做数据的持久化存储。
项目网址:http://code.google.com/p/httpsqs/
使用文档:http://blog.zyan.cc/httpsqs/
使用环境:Linux(同时支持32位、64位操作系统,推荐使用64位操作系统)
软件作者:张宴
HTTPSQS 1.7 版本更新内容:
下面的内容不只是介绍 HTTPSQS 1.7 更新了哪些东西,更多的介绍在于:如何绕开 Libevent 2.0.x evhttp 使用过程中,无法正常处理包含“|”字符的 URI 参数的问题;提供了一份比 Libevent 官方网站更新的在线文档;Linux 下如何动态编译程序,运行时不用在 /etc/ld.so.conf 文件中添加动态链接库路径。
1、针对 Libevent 2.0.x 版本 evhttp_parse_query 函数的 BUG。
网友发邮件,反应了一个 HTTPSQS 的 BUG,见下图,data 的值为NULL。我查找发现,这不是 HTTPSQS 的 BUG,而是 Libevent 2.0.x 版本的 BUG。在 Libevent 1.4.14b 版本中,evhttp_parse_query 函数是能够正常处理包含“|”字符的 URI 的,而在 Libevent 2.0.12 版本中,同样使用 evhttp_parse_query 函数,包含“|”字符的 URI 处理后的结果是 NULL。

对比 Libevent 2.0.12 和 1.4.14b 版本的 evhttp_parse_query 函数代码,发现在 2.0.12 版本中,evhttp_parse_query(const char *uri, struct evkeyvalq *headers) 实际变成了调用 evhttp_parse_query_impl(uri, headers, 1) 函数,该函数内再调用的一个 2.0.x 版本新增的函数 evhttp_uri_parse(const char *source_uri),逻辑处理代码在 evhttp_uri_parse_with_flags(const char *source_uri, unsigned flags) 函数中。evhttp_uri_parse(const char *source_uri) 无法正确解析含有“|”的URL,遇到类似“http://127.0.0.1:1218/?opt=get&name=aaa|bbb”的URL,直接返回NULL,也就是 BUG 所在。
libevent-2.0.12-stable/http.c



不建议修改第三方库,这个 BUG 还是留给 Libevent 自己去解决吧。使用 Libevent 2.0.x evhttp 作开发的同学,遇到URI参数中包含“|”的问题,注意一下吧。
我修改了 HTTPSQS 代码,在 HTTPSQS 1.7 版本,采用以下方式来绕开evhttp_uri_parse(const char *source_uri)函数,解决这个问题。其中用到了 Libevent 2.0.x evhttp_request 结构体中新增的 struct evhttp_uri *uri_elems,以及新增的函数 evhttp_parse_query_str (const char *uri, struct evkeyvalq *headers)。
- /* 处理模块 */
- void httpsqs_handler(struct evhttp_request *req, void *arg)
- {
- struct evbuffer *buf;
- buf = evbuffer_new();
- /* 分析URL参数 */
- const char *httpsqs_query_part;
- struct evkeyvalq httpsqs_http_query;
- httpsqs_query_part = evhttp_uri_get_query(req->uri_elems);
- evhttp_parse_query_str(httpsqs_query_part, &httpsqs_http_query);
Libevent 的官方文档只有 1.4.10-stable 和 2.0.1-alpha 版本的,2.0.1x 很多新增的函数、结构体都没有。
我这里提供一份最新的 Libevent 在线文档: http://blog.zyan.cc/book/libevent/
2、静态编译改为动态编译,并指定程序运行时查找的动态链接库路径
一些网友反映,CentOS 6.0、Fedora 等系统没有默认安装lz、lbz2、lrt、...等静态链接库,出现无法编译HTTPSQS的情况:
/usr/bin/ld: cannot find -lz
/usr/bin/ld: cannot find -lbz2
/usr/bin/ld: cannot find -lrt
/usr/bin/ld: cannot find -lpthread
/usr/bin/ld: cannot find -lm
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find -lc
collect2: ld 返回 1
make: *** [httpsqs] 错误 1
HTTPSQS 1.7 版本改为动态编译,编译时使用“-Wl,-rpath”参数指定了程序运行时的动态库搜索路径。这样就不需要在 /etc/ld.so.conf 中 添加 HTTPSQS 程序运行时需要的 libevent、tokyocabinet 动态链接库路径了,可以避免与其他软件(例如:Memcached、TT)使用的 libevent、tokyocabinet 动态链接库版本相冲突。详情请见 Makefile 文件:
CC=gcc
CFLAGS=-Wl,-rpath,/usr/local/libevent-2.0.12-stable/lib/:/usr/local/tokyocabinet-1.4.47/lib/ -L/usr/local/libevent-2.0.12-stable/lib/ -levent -L/usr/local/tokyocabinet-1.4.47/lib/ -ltokyocabinet -I/usr/local/libevent-2.0.12-stable/include/ -I/usr/local/tokyocabinet-1.4.47/include/ -lz -lbz2 -lrt -lpthread -lm -lc -O2 -g
httpsqs: httpsqs.c
$(CC) -o httpsqs httpsqs.c prename.c $(CFLAGS)
@echo ""
@echo "httpsqs build complete."
@echo ""
clean: httpsqs
rm -f httpsqs
install: httpsqs
install $(INSTALL_FLAGS) -m 4755 -o root httpsqs $(DESTDIR)/usr/bin
用 ldd 命令查看一下 HTTPSQS 使用的动态链接库:
linux-vdso.so.1 => (0x00007fff0ebff000)
libevent-2.0.so.5 => /usr/local/libevent-2.0.12-stable/lib/libevent-2.0.so.5 (0x00007f5157979000)
libtokyocabinet.so.9 => /usr/local/tokyocabinet-1.4.47/lib/libtokyocabinet.so.9 (0x00007f51576f6000)
libz.so.1 => /lib64/libz.so.1 (0x00000038a1400000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00000038a8800000)
librt.so.1 => /lib64/librt.so.1 (0x00000038a2000000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000038a1000000)
libm.so.6 => /lib64/libm.so.6 (0x00000038a1800000)
libc.so.6 => /lib64/libc.so.6 (0x00000038a0c00000)
/lib64/ld-linux-x86-64.so.2 (0x00000038a0400000)
发现,libevent 和 libtokyocabinet 使用的是我们指定 lib 路径中的动态链接库。
HTTPSQS 的详细使用说明,请访问: http://blog.zyan.cc/httpsqs/
Nginx 1.5.2 + PHP 5.5.1 + MySQL 5.6.10 在 CentOS 下的编译安装
2015/05/26 08:07 | by admin ]
http://blog.zyan.cc/nginx_php_v6
1、安装Nginx:
cd /Data/tgz
yum install wget
yum install pcre
yum install openssl*
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make
yum -y install gd gd2 gd-devel gd2-devel
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
ulimit -SHn 65535
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gz
tar zxvf pcre-8.32.tar.gz
cd pcre-8.32
./configure --prefix=/Data/apps/pcre
make && make install
cd ../
wget http://nginx.org/download/nginx-1.5.2.tar.gz
tar zxvf nginx-1.5.2.tar.gz
cd nginx-1.5.2
./configure --user=www --group=www --prefix=/Data/apps/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/Data/tgz/pcre-8.32 --with-http_realip_module --with-http_image_filter_module
make
make install
cd ../
2、安装 MySQL:
tar zxvf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.10-linux-glibc2.5-x86_64 /Data/apps/mysql
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
mkdir -p /Data/data/mysql/data
yum install libaio
/Data/apps/mysql/scripts/mysql_install_db --basedir=/Data/apps/mysql --datadir=/Data/data/mysql/data --user=mysql
sed -i "s#/usr/local/mysql#/Data/apps/mysql#g" /Data/apps/mysql/bin/mysqld_safe
3、安装PHP依赖库
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
tar zxvf jpegsrc.v9.tar.gz
cd jpeg-9/
./configure --prefix=/Data/apps/libs --enable-shared --enable-static --prefix=/Data/apps/libs
make
make install
cd ../
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz
tar zxvf libpng-1.6.2.tar.gz
cd libpng-1.6.2/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
tar zxvf freetype-2.4.12.tar.gz
cd freetype-2.4.12/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
wget "http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?big_mirror=0"
wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?big_mirror=0"
wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?big_mirror=0"
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure --prefix=/Data/apps/libs
make
make install
cd libltdl/
./configure --prefix=/Data/apps/libs --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
添加:
然后:
cd mcrypt-2.6.8/
export LDFLAGS="-L/Data/apps/libs/lib -L/usr/lib"
export CFLAGS="-I/Data/apps/libs/include -I/usr/include"
touch malloc.h
./configure --prefix=/Data/apps/libs --with-libmcrypt-prefix=/Data/apps/libs
make
make install
cd ../
4、编译安装PHP 5.5
tar zxvf php-5.5.1.tar.gz
cd php-5.5.1/
export LIBS="-lm -ltermcap -lresolv"
export DYLD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
export LD_LIBRARY_PATH="/Data/apps/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
./configure --prefix=/Data/apps/php --with-config-file-path=/Data/apps/php/etc --with-mysql=/Data/apps/mysql --with-mysqli=/Data/apps/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir=/Data/apps/libs --with-jpeg-dir=/Data/apps/libs --with-png-dir=/Data/apps/libs --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/Data/apps/libs --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql --enable-maintainer-zts
make
make install
cp php.ini-development /Data/apps/php/etc/php.ini
cd ../
ln -s /Data/apps/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
mv /Data/apps/php/etc/php-fpm.conf.default /Data/apps/php/etc/php-fpm.conf
5、编译安装PHP扩展
tar zxvf autoconf-latest.tar.gz
cd autoconf-2.69/
./configure --prefix=/Data/apps/libs
make
make install
cd ../
wget http://pecl.php.net/get/memcache-2.2.7.tgz
tar zxvf memcache-2.2.7.tgz
cd memcache-2.2.7/
export PHP_AUTOCONF="/Data/apps/libs/bin/autoconf"
export PHP_AUTOHEADER="/Data/apps/libs/bin/autoheader"
/Data/apps/php/bin/phpize
./configure --with-php-config=/Data/apps/php/bin/php-config
make
make install
cd ../
打开 /Data/apps/php/etc/php.ini 查找 ; extension_dir = "ext"
在其后增加一行:
Windows Server 2008 R2 Enterprise[企业版]多国语言版
2015/05/25 07:38 | by admin ]
1、首先声明本作品不含任何个人信息,本作品只用作技术上的学习与交流,不作其它任何盈利用途!
2、采用微软MSDN英文原版为母盘,加入“简体、香港繁体、台湾繁体”语言包!
3、Windows Server 2008 R2 Enterprise企业版——在PE安装时、安装好系统之后,均可以选择、切换系统显示语言!
4、35in1品牌数量为33个,头3个为MSDN版本(1、MSDN原版;2、MSDN开启6项功能;3、MSDN开启6项功能和更新系统补丁至2010年9月28日),因为是包含4个区域也相当于35系统*4区域=140in1
5、品牌顺序按字母排列:MSDN、OEMALL、Acer、Alienware、ASUS、BENQ、Compaq、DELL、eMachines、Founder、Fujitsu、Gateway、Gigabyte、GreatWall、Haier、Hasee、Hedy、HP、HPVoodooPC、Lenovo、LG、Medion、MSI、NEC、PackardBell、Panasonic、Samsung、Sharp、Sony、TCL、Thinkpad、TongFang、Toshiba
企业版:TFGPQ-J9267-T3R9G-99P7B-HXG47
Windows Server 2008官方原版镜像下载地址(每个系列只有1个安装包)
Windows Server 2008 64位 中文版下载地址(用迅雷下载)
ed2k://|file|cn_windows_server_2008_standard_enterprise_and_datacenter_with_sp2_x64_dvd_x15-41319.iso|2952992768|5F2CA73C9DA296CB05E7C0319F7D0E62|/
文件名:cn_windows_server_2008_standard_enterprise_and_datacenter_with_sp2_x64_dvd_x15-41319.iso
SHA1:E722E8F91722EFE988FA274A5062EE978E53C22A
文件大小:2.75GB
发布时间:2009-06-16
Windows Server 2008 32位 中文版下载地址(用迅雷下载)
ed2k://|file|cn_windows_server_standard_enterprise_and_datacenter_with_sp2_x86_dvd_x15-41045.iso|2190057472|E93B029C442F19024AA9EF8FB02AC90B|/
文件名:cn_windows_server_standard_enterprise_and_datacenter_with_sp2_x86_dvd_x15-41045.iso
SHA1:80F1E47364AD05C28763EA29D7A11527C8067A3F
文件大小:2.04GB
发布时间:2009-06-16
Windows Server 2008 R2 中文版下载地址(用迅雷下载)
ed2k://|file|cn_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_vl_build_x64_dvd_617396.iso|3368962048|7C210CAC37A05F459758BCC1F4478F9E|/
文件名:cn_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_vl_build_x64_dvd_617396.iso
SHA1:A92C97C38EF6ED5F827637179052AD218900377A
文件大小:3.14GB
发布时间:2011-02-21
Windows Server 2008 R2 英文版下载地址(用迅雷下载)
ed2k://|file|en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_vl_build_x64_dvd_617403.iso|3166720000|54056D959F64770EB5E0A7B1FB6A0BE2|/
文件名:en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_vl_build_x64_dvd_617403.iso
SHA1:7E7E9425041B3328CCF723A0855C2BC4F462EC57
文件大小:2.95GB
发布时间:2011-02-16
Windows Server 2012 中文版下载地址(用迅雷下载)
ed2k://|file|cn_windows_server_2012_vl_x64_dvd_917962.iso|3827054592|2F40F8D0D60B86E9FFA551624D5A5257|/
文件名:cn_windows_server_2012_vl_x64_dvd_917962.iso
SHA1:C02CE28DCBE0CC745EA1035EB051A0EF02C0164F
文件大小:3.56GB
发布时间:2012-09-04
Windows Server 2012 英文版下载地址(用迅雷下载)
ed2k://|file|en_windows_server_2012_vl_x64_dvd_917758.iso|3694114816|AE62DB062FD9D433750F54F4518AF4C5|/
文件名:en_windows_server_2012_vl_x64_dvd_917758.iso
SHA1:063BC26ED45C50D3745CCAD52DD7B3F3CE13F36D
文件大小:3.44GB
发布时间:2012-09-04
Windows Server 2012 R2 中文版下载地址(用迅雷下载)
ed2k://|file|cn_windows_server_2012_r2_vl_with_update_x64_dvd_4051059.iso|4683122688|BD0B95997679F83A4EE2D062865D8E64|/
文件名:cn_windows_server_2012_r2_vl_with_update_x64_dvd_4051059.iso
SHA1:75BB45680A0CCA0B33E7EE70F20037599BDB2929
文件大小:4.36GB
发布时间:2014-04-08
Windows Server 2012 R2 英文版下载地址(用迅雷下载)
ed2k://|file|en_windows_server_2012_r2_vl_with_update_x64_dvd_4065221.iso|4548247552|CAB7FBCD275AF5F62E89C02EF898893D|/
文件名:en_windows_server_2012_r2_vl_with_update_x64_dvd_4065221.iso
SHA1:D4B28F350981A7C3306DD409B172AEA10D8599AC
文件大小:4.24GB
发布时间:2014-04-02





