Linux上全源码安装Apache、MySQL、PHP、WSF安装(转载)

Linux上全源码安装Apache、MySQL、PHP、WSF安装

博客分类: PHP
PHPMySQLApacheLinuxSQLite
Linux上全源码安装Apache、MySQL、PHP、WSF安装(原创)
需要root权限
Apache安装
下载
# wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz
安装
# tar zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
#./configure --prefix=/usr/local/apache2 --enable-so
# make
# make install
# make clean
系统启动时自动加载Apache
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
# cd /etc/rc.d/rc3.d
# ln –s ../init.d/httpd S80httpd
MySQL安装
下载
# wget http://mysql.ntu.edu.tw/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
安装
# tar zxvf mysql-5.0.45.tar.gz
# cd mysql-5.0.45
# ./configure --prefix=/usr/local/mysql --enable-thread-safe-client --with-charset=utf8
# make
# make install
# cp support-files/my-medium.cnf /etc/my.cnf
# make clean
创建mysql用户
# groupadd mysql
# useradd -g mysql mysql
设置目录访问权限
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
# bin/mysql_install_db --user=mysql (初始化表)
# chown -R root .
# chown -R mysql var
运行
# /usr/local/mysql/bin/mysqld_safe --user=mysql
LibXML2安装(Linux默认已经存在)
下载
# wget ftp://xmlsoft.org/libxml2/libxml2-2.6.30.tar.gz
安装
# tar zxvf libxml2-2.6.30.tar.gz
# cd libxml2-2.6.30
# ./configure --prefix=/usr/local/libxml2 --exec-prefix=/usr
# make
# make install
# make clean
Zlib安装
下载
# wget http://www.zlib.net/zlib-1.2.3.tar.gz
安装
# tar zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/zlib --exec-prefix=/usr
# make
# make install
# make clean
LibIconv安装
下载
# wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz
安装
# tar zxvf libiconv-1.12.tar.gz
# cd libiconv-1.12
# ./configure --prefix=/usr/local/libiconv



# make
# make install
# make clean
PHP安装
下载
# wget http://cn2.php.net/distributions/php-5.2.5.tar.gz
安装(先安装libiconv-1.14.tar.gz)
# tar zxvf php-5.2.5.tar.gz
# cd php-5.2.5
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-zlib --with-iconv=/usr/local/libiconv --with-config-file-path=/home/admin/aep/forum/conf
# make
# make install
# make clean
# cp php.ini-dist /home/admin/aep/forum/conf/php.ini
# vi /home/admin/aep/forum/conf/httpd.conf
任意位置添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
pkg-config安装(如果低于0.20版本)
下载
# wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz
安装
# tar zxvf pkg-config-0.22.tar.gz
# cd pkg-config-0.22
# ./configure --prefix=/usr
# make
# make install
# make clean
SQLite安装
下载
# wget http://www.sqlite.org/sqlite-3.5.3.tar.gz
安装
# tar zxvf sqlite-3.5.3.tar.gz
# cd sqlite-3.5.3
# ./configure --prefix=/usr --disable-tcl
# make
# make install
# make clean
OpenSSL安装(可选)
下载
# wget http://www.openssl.org/source/openssl-0.9.8b.tar.gz
安装
# tar zxvf openssl-0.9.8b.tar.gz
# cd openssl-0.9.8b
# ./config --prefix=/usr/ --openssldir=/usr/local/openssl
# make
# make install
# make clean
WSF安装
下载
# wget http://dist.wso2.org/products/wsf/php/wso2-wsf-php-src-1.1.0.tar.gz
安装
# tar zxvf wso2-wsf-php-src-1.1.0.tar.gz
# cd wso2-wsf-php-src-1.1.0
# ./configure --with-apache2=/usr/local/apache2/include --with-wsf --enable-savan=no --with-php-config=/usr/local/php/bin/php-config
# make
# make install
# make clean
默认情况下,WSF被安装在/wsf_c,wsf.so被编译到/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
# vi /home/admin/aep/forum/conf/php.ini
找到extension_dir = "./",改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
在php.ini任意位置添加
[wsf]
wsf.home= /wsf_c
wsf.log_path= /wsf_c/logs
wsf.log_level = 3
wsf.rm_db_dir= /wsf_c
extension=wsf.so
测试
重启Apache
# /usr/local/php/bin/php -m
看wsf模块是否在列表中
PHP ws-security代码样例(WS安全带签名)
Python代码 
<span style="font-size: x-small;"><span style="font-size: small;">$reqPayloadString =<<<XML 
<xsd:getAppByAppId  
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:xsd="http://subsc.api.core.aep.alisoft.com"> 
<xsd:param0>$appid</xsd:param0> 
</xsd:getAppByAppId> 
XML; 
$my_cert = ws_get_cert_from_file("./keys/aepforum_cert.cert"); 
$my_key = ws_get_key_from_file("./keys/aepforum_key.pem"); 
$rec_cert = ws_get_cert_from_file("./keys/aep_cert.cert"); 
 
$reqMessage = new WSMessage($reqPayloadString, array ( 
"to" => "http://api.alisoft.com:1688/webservice/AppWebService", 
"action" => "http://subsc.api.core.aep.alisoft.com/getAppByAppId" 
)); 
 
$sec_array = array ( 
"sign" => TRUE, 
"securityTokenReference" => "IssuerSerial", 
"algorithmSuite" => "Basic256Rsa15" 
); 
$policy = new WSPolicy(array ( 
"security" => $sec_array 
)); 
 
$sec_token = new WSSecurityToken(array ( 
"privateKey" => $my_key, 
"certificate" => $my_cert, 
"receiverCertificate" => $rec_cert 
)); 
 
$client = new WSClient(array ( 
"useWSA" => TRUE, 
"policy" => $policy, 
"securityToken" => $sec_token 
)); 
 
$resMessage = $client->request($reqMessage); 
 
$xml = new SimpleXMLElement($resMessage->str); 
$name = $xml->return[0]->appName; 
$username = $xml->return[0]->isvPassPort; 
$description = $xml->return[0]->description;</span></span> 




原文地址:http://aaronjiu.iteye.com/blog/164860

猜你喜欢

转载自ernestchen.iteye.com/blog/1618328