Apache 2 and PHP 5 (mod_php) on Linux
Apache 2 and PHP Installation
The following notes are how I got Apache 2 and PHP 5 (or PHP 4) working together on Linux. These instructions also apply, mostly, for any UNIX-like system, especially other Linux distributions. If you have a recent Linux distribution (say since 2002), you already have Apache 2 and PHP, so you don't need to do this unless you want the latest Apache 2 or PHP release or need to customize the Apache or PHP software. Don't forget to remove (or at least disable) the Apache rpm package if you install your own custom Apache.
Apache 2 Version Tip: Beginning with Apache 2.0.42 the API will be kept stable (yeah!). That means you will NOT have to recompile modules (and possibly upgrade/fix source) every time you install a new Apache release. This assumes you stay in the same Apache release series. For example, upgrading from 2.2.0 to 2.2.2 should work. This will not apply to upgrading to the next series (e.g., "development" 2.3.x or "stable" 2.4.x).
I was only able to get PHP working with Apache 2 as a *.so DSO ("dynamic shared object"), as opposed to compiled into Apache (with a static *.a library). I think DSO is the only way PHP is supported now on Apache 2.
I first used httpd-2.0.43 and php-4.3.0 with RedHat 7.3. I am now using httpd-2.2.3 and php-5.2.0 with SUSE 10.1.
Note: If you have problems with PHP and think it's a recent bug, you may want to consider using the latest http://snaps.php.net/ snapshot. Beware that snapshots frequently have regression and are not for production use. Usually problems are because of mis-configuration, not bugs, so snapshots will probably hurt more than help.
Download/unpack Apache2 source from the Apache httpd server website, http://httpd.apache.org/
In the Apache 2 source directory, create a Makefile by typing:
./configure --prefix=/usr/local/apache \
--enable-so \
--enable-cgi \
--enable-info \
--enable-rewrite \
--enable-speling \
--ena
相关文档:
系统及软件版本
FreeBSD 7.3
Apache-2.2.14-5[ 1.3.42(Unix)]
PHP-5.2.12
MySQL-5.0.90
Freebsd通过port安装nginx
Nginx ("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,它已经在该站点运行超过两 ......
1.
前言
我使用的主机名为server1.example.com
,ip
地址是192.168.0.100
。这些设置可能与你想要的有所不同,所以你必须在适当的地方修改一下。
2
安装MySQL5
用下列命令安装MySQL
:
yum install mysql mysql-server
然后我们为MySQL
创建系统启动链接(这样的话,MySQL
就会随着系统启动而启动),并启动 ......
<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else ec ......
<?php
//单例模式的类Lock
class
Lock
{
//静态属性$instance
  ......
所需软件源代码包:
httpd-2.2.4.tar.gz mysql-5.0.27.tar.gz php-5.2.1.tar.bz2
freetype-2.3.2.tar.gz gd-2.0.34.tar.gz jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2 libxml2-2.6.24.tar.bz2 zlib-1.2.2.tar.gz
安装顺序:apache -> mysql ......