安装环境:VMware Workstation 5.5.0 build-18463
Linux版本:Red Hat Enterprise Linux AS (2.6.9-42.EL)
软件版本:MySQL5 - mysql-5.0.37.tar.gz
Apache2 - httpd-2.2.4.tar.gz
PHP5 - php-5.2.1.tar.gz
(将以上文件保存至/home/tmp目录)
[MySQL]
# cd /home/tmp (进入压缩包所在目录)
# groupadd mysql (建立mysql组)
# useradd -g mysql mysql (在mysql组中建立mysql用户)
# tar -zxvf mysql-5.0.37.tar.gz (解压mysql源码,bz2压缩包请用“tar -jvxf 文件名”指令)
# cd mysql-5.0.37 (进入解压目录)
# ./configure --prefix=/usr/local/mysql (prefix参数指明mysql安装目录)
# make
# make install
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf (复制mysql配置文档到/etc目录)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cd /usr/local/mysql (进入mysql安装目录)
# chown -R root ......
安装环境:VMware Workstation 5.5.0 build-18463
Linux版本:Red Hat Enterprise Linux AS (2.6.9-42.EL)
软件版本:MySQL5 - mysql-5.0.37.tar.gz
Apache2 - httpd-2.2.4.tar.gz
PHP5 - php-5.2.1.tar.gz
(将以上文件保存至/home/tmp目录)
[MySQL]
# cd /home/tmp (进入压缩包所在目录)
# groupadd mysql (建立mysql组)
# useradd -g mysql mysql (在mysql组中建立mysql用户)
# tar -zxvf mysql-5.0.37.tar.gz (解压mysql源码,bz2压缩包请用“tar -jvxf 文件名”指令)
# cd mysql-5.0.37 (进入解压目录)
# ./configure --prefix=/usr/local/mysql (prefix参数指明mysql安装目录)
# make
# make install
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf (复制mysql配置文档到/etc目录)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cd /usr/local/mysql (进入mysql安装目录)
# chown -R root ......
安装环境:VMware Workstation 5.5.0 build-18463
Linux版本:Red Hat Enterprise Linux AS (2.6.9-42.EL)
软件版本:MySQL5 - mysql-5.0.37.tar.gz
Apache2 - httpd-2.2.4.tar.gz
PHP5 - php-5.2.1.tar.gz
(将以上文件保存至/home/tmp目录)
[MySQL]
# cd /home/tmp (进入压缩包所在目录)
# groupadd mysql (建立mysql组)
# useradd -g mysql mysql (在mysql组中建立mysql用户)
# tar -zxvf mysql-5.0.37.tar.gz (解压mysql源码,bz2压缩包请用“tar -jvxf 文件名”指令)
# cd mysql-5.0.37 (进入解压目录)
# ./configure --prefix=/usr/local/mysql (prefix参数指明mysql安装目录)
# make
# make install
# /usr/local/mysql/bin/mysql_install_db --user=mysql
# cp support-files/my-medium.cnf /etc/my.cnf (复制mysql配置文档到/etc目录)
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 700 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# cd /usr/local/mysql (进入mysql安装目录)
# chown -R root ......
php 通用的调用 so的方法是使用dl()函数,但是在php5.3之后不再支持这种方法,仅支持静态调用,使用dl() 动态调用的方法见:
引用页1: http://tech.idv2.com/2007/07/06/use-local-so-in-php/
感谢原作者提供的清晰明了的方法,但是我在5.3.1版本i中没有通过,于是我找到了页面:
引用页2: http://www.9php.com/FAQ/cxsjl/php/2007/11/9405479103083.html
此页面中有讨论到如何静态调用so文件中的函数的描述,解决方法如下:
环境:Apache 2.2.9
php5.3.2
首先使用引用页1提供的方法生成动态库 libhello.so.
进入php 安装包解压缩目录
-laptop:~/dev/software/php-5.3.2$cd ext
funny@funny-laptop:~/dev/software/php-5.3.2/ext$
建立中间 php链接so项目cltest
funny@funny-laptop:~/dev/software/php-5.3.2/ext$ ./ext_skel --extname=cltest
Creating directory cltest
Creating basic files: config.m4 config.w32 .cvsignore cltest.c php_cltest.h CREDITS EXPERIMENTAL tests/001.phpt cltest.php [done].
To use your new extension, you will have to ......
php 通用的调用 so的方法是使用dl()函数,但是在php5.3之后不再支持这种方法,仅支持静态调用,使用dl() 动态调用的方法见:
引用页1: http://tech.idv2.com/2007/07/06/use-local-so-in-php/
感谢原作者提供的清晰明了的方法,但是我在5.3.1版本i中没有通过,于是我找到了页面:
引用页2: http://www.9php.com/FAQ/cxsjl/php/2007/11/9405479103083.html
此页面中有讨论到如何静态调用so文件中的函数的描述,解决方法如下:
环境:Apache 2.2.9
php5.3.2
首先使用引用页1提供的方法生成动态库 libhello.so.
进入php 安装包解压缩目录
-laptop:~/dev/software/php-5.3.2$cd ext
funny@funny-laptop:~/dev/software/php-5.3.2/ext$
建立中间 php链接so项目cltest
funny@funny-laptop:~/dev/software/php-5.3.2/ext$ ./ext_skel --extname=cltest
Creating directory cltest
Creating basic files: config.m4 config.w32 .cvsignore cltest.c php_cltest.h CREDITS EXPERIMENTAL tests/001.phpt cltest.php [done].
To use your new extension, you will have to ......
MySQL 5.0 以上支持存储过程。
PHP 5.0 以上的 mysqli 系列函数可以支持操作 MySQL 的存储过程。
以下是一些简单的存储过程和用 PHP 调用的示例。 一、返回单个数据: 1: <?php
2: header("Content-Type:text/html;charset=utf-8");
3:
4: $host = "localhost";
5: $user = "root";
6: $password = "mypassword";
7: $db = "test_store_proc";
8: $dblink = mysqli_connect($host, $user, $password, $db) or die("can't connect to mysql");
9:
10: $dblink->query('SET NAMES UTF8');
11: if ($result = $dblink->query("CALL sp_test0(@num, @x, 123)"))
12: {
13: $rs = $dblink->query("select @num");
14: $row = $rs->fetch_array();
15: echo $row['@num'], '<br>';
16:
17: $rs = $dblink->query("select @x&qu ......
MySQL 5.0 以上支持存储过程。
PHP 5.0 以上的 mysqli 系列函数可以支持操作 MySQL 的存储过程。
以下是一些简单的存储过程和用 PHP 调用的示例。 一、返回单个数据: 1: <?php
2: header("Content-Type:text/html;charset=utf-8");
3:
4: $host = "localhost";
5: $user = "root";
6: $password = "mypassword";
7: $db = "test_store_proc";
8: $dblink = mysqli_connect($host, $user, $password, $db) or die("can't connect to mysql");
9:
10: $dblink->query('SET NAMES UTF8');
11: if ($result = $dblink->query("CALL sp_test0(@num, @x, 123)"))
12: {
13: $rs = $dblink->query("select @num");
14: $row = $rs->fetch_array();
15: echo $row['@num'], '<br>';
16:
17: $rs = $dblink->query("select @x&qu ......
function getsock($strUrl,$arrParameter=array(),$strMethod="POST"){
if(!$strUrl||!$strMethod){ return "";}
$strMethod = strtoupper($strMethod);
$arrUrl = parse_url($strUrl);
if($arrUrl["port"]==0){$arrUrl["port"]=80;}
$fso = fsockopen($arrUrl["host"],$arrUrl["port"],$intErrno,$strError,10);
if(!$fso){
return "";
}else{
$strFileName = $arrUrl["path"];
if($arrUrl["query"]!=""){
$strFileName.= "?".$arrUrl["query"];
}
$strHeader = "$strMethod $strFileName HTTP/1.1\r\n";
$strHeader .= "Host:".$arrUrl["host"].":".$arrUrl["port"]."\r\n";
if($strMethod=="POST"){
if(is_array($arrParameter)){
$blnFlag = 0;
foreach($arrParameter as $strKey=>$Value){
if($blnFlag){
&nb ......
本文软件的下载地址就不列出,主要是记录安装时的步骤及相关问题的处理方法;基于安装方法目前有两种,一种是利用RPM包安装,一种源码编译安装;以下主
要是以源码编译安装;因为源码安装软件的相互依赖性小,安装方式用各种unix/linux系统,维护方便。如果想去除相关服务时,直接rm
–rf目录 即可;建议采用源码方式安装;
系统环境和需要的软件:
1、CentOS
2、httpd-xxx.tar.gz
3、php5-xxx.tar.gz
4、mysql-xxx.tar.gz
5、所有软件安装目录/usr/local/
服务器软件安装顺序:Apache(httpd) --> Mysql --> PHP
Apache编译安装
[root@server src]# tar -zxvf /home/soft/httpd-2.0.63.tar.gz
[root@server src]# cd httpd-2.0.63/
[root@server httpd-2.0.63]#./configure --prefix=/usr/local/apache --enable-so
[root@server httpd-2.0.63]# make clean; make
[root@server httpd-2.0.63]## make install
执行完以上命令后,执行 /usr/local/apache/bin/httpd -l检查mod_so模块是否已编译,如下图:
Mysql编译安装
[root@server src]# tar -zxvf /home/soft/mysql-5.0.56.tar.gz
[root@server src]# cd mysql-5.0.56/
[root ......
本文软件的下载地址就不列出,主要是记录安装时的步骤及相关问题的处理方法;基于安装方法目前有两种,一种是利用RPM包安装,一种源码编译安装;以下主
要是以源码编译安装;因为源码安装软件的相互依赖性小,安装方式用各种unix/linux系统,维护方便。如果想去除相关服务时,直接rm
–rf目录 即可;建议采用源码方式安装;
系统环境和需要的软件:
1、CentOS
2、httpd-xxx.tar.gz
3、php5-xxx.tar.gz
4、mysql-xxx.tar.gz
5、所有软件安装目录/usr/local/
服务器软件安装顺序:Apache(httpd) --> Mysql --> PHP
Apache编译安装
[root@server src]# tar -zxvf /home/soft/httpd-2.0.63.tar.gz
[root@server src]# cd httpd-2.0.63/
[root@server httpd-2.0.63]#./configure --prefix=/usr/local/apache --enable-so
[root@server httpd-2.0.63]# make clean; make
[root@server httpd-2.0.63]## make install
执行完以上命令后,执行 /usr/local/apache/bin/httpd -l检查mod_so模块是否已编译,如下图:
Mysql编译安装
[root@server src]# tar -zxvf /home/soft/mysql-5.0.56.tar.gz
[root@server src]# cd mysql-5.0.56/
[root ......
很多时候我们喜欢用js来获取日期和时间,但这仅仅是客户端的。
我们可以用php的date函数即可来获取服务器上的时间:
<?php
//将时区设置为中国
date_default_timezone_set("PRC");
echo date("Y-m-d l H:i:s A");
//例输出:2010-03-06 Saturday 11:51:29 AM
?> ......