Chapter 3.  PHP

Table of Contents

Installation
for Apache
for Lighttpd
APC Cache
安装
更多阅读链接
Memcache
Zend Optimizer
安装
配置项说明
问题和解决方法
phpzie
如何使用
官方解释
PHP predefined variables
$_SERVER
SOAP from PHP
PHP安装SOAP扩展
PHP建立SOAP服务器
PHP建立SOAP客户端请求

Installation

for Apache



./configure --prefix=/usr/local/php-5.2.11 \
--with-config-file-path=/usr/local/php-5.2.11/etc \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-curl \
--with-gd \
--with-ldap \
--with-snmp \
--with-iconv \
--with-zlib-dir \
--with-pear \
--with-mysql=../mysql-5.1.41-linux-x86_64-icc-glibc23 \
--with-mysqli \
--with-pdo-mysql \
--with-libxml-dir \
--with-xmlrpc \
--enable-zip \
--enable-exif \
--enable-sockets \
--enable-soap

make
make test
make install



-- CGI方式 --
httpd.conf

  ScriptAlias /php/ "C:/Program Files/php-5.2.10/"
  AddType application/x-httpd-php .php
  Action application/x-httpd-php "/php/php-cgi.exe"
  AddType application/x-httpd-php .html

  注意,如果安装后出现You don't have permission to access / on this server.
  或者出现无法运行php文件的情况下
  查找httpd.conf中的
  Deny from all
  改为
  Allow from all


  注意:You don't have permission to access /php/php-cgi.exe/index.php on this server.

  网上搜索了好多,不少人都有这个问题。后来在一个nl后缀的网站上提到了权限的问题。 

  添了一个

  <Directory "d:/www/php524">

      Order deny,allow
      Deny from none

  </Directory> 

  就可以了,其中Deny from none还可以改为 Allow from all。终于解决了php-cgi安装方式的问题。 


php.ini

  如果使用CGI模式,请修改php.ini的设置: cgi.force_redirect = 1,以增强apache的安全性,



-- Module方式--
httpd.conf

	LoadModule php5_module "C:/Program Files/php-5.2.10/php5apache2_2.dll"
	PHPIniDir "C:/Program Files/php-5.2.10/"
	AddType application/x-httpd-php .php
	AddType application/x-httpd-php .html







	
			

for Lighttpd


1. 下载PHP

      cd /usr/local/src/
      wget http://cn2.php.net/get/php-5.2.3.tar.bz2/from/cn.php.net/mirror
      tar jxvf php-5.2.3.tar.bz2
      cd php-5.2.3

2. configure

      ./configure --prefix=/usr/local/php-5.2.3 \
      --with-config-file-path=/usr/local/php-5.2.3/etc \
      --enable-fastcgi \
      --enable-force-cgi-redirect \
      --with-curl \
      --with-gd \
      --with-ldap \
      --with-snmp \
      --enable-zip \
      --enable-exif \
      --with-pdo-mysql \
      --with-pdo-pgsql \

      make
      make test
      make install
      				

      其它有用的模块

      --enable-pcntl

3. 符号连接

      ln -s /usr/local/php-5.2.3 /usr/local/php
      ln -s /usr/local/php/bin/php /usr/local/bin/php

4. php.ini

      cp php.ini-dist /usr/local/php/etc/php.ini

5. env

      PHP_FCGI_CHILDREN=384

6. 使用 php -v FastCGI 安装情况

      php -v 或 php-cgi -v

      显示(cgi-fcgi)表示正确

      # cd /usr/local/php/
      # bin/php -v
      PHP 5.2.2 (cgi-fcgi) (built: May 25 2007 15:50:28)
      Copyright (c) 1997-2007 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      				

      (cgi-fcgi)不能正常工作

      PHP 5.2.2 (cli) (built: May 25 2007 15:50:28)
      Copyright (c) 1997-2007 The PHP Group
      Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      				

      使用 php -m 或php-cgi -m 查看PHP Modules

      # bin/php -m
      [PHP Modules]
      cgi-fcgi
      ctype
      date
      dom
      filter
      gd
      hash
      iconv
      json
      ldap
      libxml
      mssql
      pcre
      PDO
      pdo_mysql
      pdo_sqlite
      posix
      Reflection
      session
      SimpleXML
      snmp
      SPL
      SQLite
      standard
      tokenizer
      xml
      xmlreader
      xmlwriter
      zip

      [Zend Modules]
      				

apt-get install

$ sudo apt-get install php5 php5-cli php5-cgi