WWW を検索 NOGNOG.COM を検索

WWW.NOGNOG.COM

Last modified: Sat, 12 Jul 2008 12:15:22 +0900
Home   うにっくすさんの覚え書き   プリングルズ   MIDI   ユーザー車検   「小沢昭一の小沢昭一的こころ」のススメ   Blog  

Apache2(Win32) - PHP5

 先に実施していたWin32版 Apacheのインストールに続いて、PHP5の有効化について解説します。

用意するもの


  • php-5.2.6-Win32.zip

  • 公式ページ

  • ダウンロードページ

    展開&インストール


    php-5.2.5-Win32.zip を解凍すると、php-5.2.5-Win32フォルダが作成されるので、
    このフォルダを「C:\php」として配置します。

      apache2_win32_PHP5_00.png

      apache2_win32_PHP5_01.png

    続いて php5ts.dll をC:\Windows(\WINNT) へコピーします。
    更に C:\php\php.ini-dist ファイルを、C:\php\php.ini と C:\Windows(\WINNT)\php.ini として2箇所へコピーします。
    設定ファイルを2箇所に設置する理由は、使用用途によってphp.iniの参照元が異なる為です。

    • Apacheモジュールは、C:\php\php.iniを参照
    • CLI(コマンドライン)は、C:\Windows(or \WINNT)\php.iniを参照

      apache2_win32_PHP5_02.png

      apache2_win32_PHP5_03.png

    コンフィグレーション


    • C:\php.ini & C:\Windows(or \WINNT)\php.ini

      下記の修正を適用します。

      --- php.ini-dist        2006-11-02 12:41:34.000000000 +0900
      +++ php.ini     2007-01-21 17:56:13.271574000 +0900
      @@ -582,40 +582,40 @@
       ; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
       ; extension folders as well as the separate PECL DLL download (PHP 5).
       ; Be sure to appropriately set the extension_dir directive.
      -
      -;extension=php_mbstring.dll
      -;extension=php_bz2.dll
      -;extension=php_curl.dll
      -;extension=php_dba.dll
      -;extension=php_dbase.dll
      -;extension=php_exif.dll
      -;extension=php_fdf.dll
      -;extension=php_filepro.dll
      -;extension=php_gd2.dll
      -;extension=php_gettext.dll
      -;extension=php_ifx.dll
      -;extension=php_imap.dll
      -;extension=php_interbase.dll
      -;extension=php_ldap.dll
      -;extension=php_mcrypt.dll
      -;extension=php_mhash.dll
      -;extension=php_mime_magic.dll
      -;extension=php_ming.dll
      -;extension=php_mssql.dll
      -;extension=php_msql.dll
      -;extension=php_mysql.dll
      -;extension=php_oci8.dll
      -;extension=php_openssl.dll
      -;extension=php_oracle.dll
      -;extension=php_pgsql.dll
      -;extension=php_shmop.dll
      -;extension=php_snmp.dll
      -;extension=php_sockets.dll
      -;extension=php_sqlite.dll
      -;extension=php_sybase_ct.dll
      -;extension=php_tidy.dll
      -;extension=php_xmlrpc.dll
      -;extension=php_xsl.dll
      +extension_dir="C:\php\ext"
      +extension=php_mbstring.dll
      +extension=php_bz2.dll
      +extension=php_curl.dll
      +extension=php_dba.dll
      +extension=php_dbase.dll
      +extension=php_exif.dll
      +extension=php_fdf.dll
      +extension=php_filepro.dll
      +extension=php_gd2.dll
      +extension=php_gettext.dll
      +extension=php_ifx.dll
      +extension=php_imap.dll
      +extension=php_interbase.dll
      +extension=php_ldap.dll
      +extension=php_mcrypt.dll
      +extension=php_mhash.dll
      +extension=php_mime_magic.dll
      +extension=php_ming.dll
      +extension=php_mssql.dll
      +extension=php_msql.dll
      +extension=php_mysql.dll
      +extension=php_oci8.dll
      +extension=php_openssl.dll
      +extension=php_oracle.dll
      +extension=php_pgsql.dll
      +extension=php_shmop.dll
      +extension=php_snmp.dll
      +extension=php_sockets.dll
      +extension=php_sqlite.dll
      +extension=php_sybase_ct.dll
      +extension=php_tidy.dll
      +extension=php_xmlrpc.dll
      +extension=php_xsl.dll
       
       
       ;;;;;;;;;;;;;;;;;;;
      @@ -624,7 +624,7 @@
       
       [Date]
       ; Defines the default timezone used by the date functions
      -;date.timezone =
      +date.timezone = Asia/Tokyo
       
       ;date.default_latitude = 31.7667
       ;date.default_longitude = 35.2333
      @@ -1119,34 +1119,34 @@
       
       [mbstring]
       ; language for internal character representation.
      -;mbstring.language = Japanese
      +mbstring.language = Japanese
       
       ; internal/script encoding.
       ; Some encoding cannot work as internal encoding.
       ; (e.g. SJIS, BIG5, ISO-2022-*)
      -;mbstring.internal_encoding = EUC-JP
      +mbstring.internal_encoding = EUC-JP
       
       ; http input encoding.
      -;mbstring.http_input = auto
      +mbstring.http_input = EUC-JP,SJIS
       
       ; http output encoding. mb_output_handler must be
       ; registered as output buffer to function
      -;mbstring.http_output = SJIS
      +mbstring.http_output = EUC-JP
       
       ; enable automatic encoding translation according to
       ; mbstring.internal_encoding setting. Input chars are
       ; converted to internal encoding by setting this to On.
       ; Note: Do _not_ use automatic encoding translation for
       ;       portable libs/applications.
      -;mbstring.encoding_translation = Off
      +mbstring.encoding_translation = On
       
       ; automatic encoding detection order.
       ; auto means
      -;mbstring.detect_order = auto
      +mbstring.detect_order = auto
       
       ; substitute_character used when character cannot be converted
       ; one from another
      -;mbstring.substitute_character = none;
      +mbstring.substitute_character = EUC-JP;
       
       ; overload(replace) single byte functions by mbstring functions.
       ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
      @@ -1156,7 +1156,7 @@
       ; 1: Overload mail() function
       ; 2: Overload str*() functions
       ; 4: Overload ereg*() functions
      -;mbstring.func_overload = 0
      +mbstring.func_overload = 0
       
       [FrontBase]
       ;fbsql.allow_persistent = On

    • C:\usr\local\apache\conf\httpd.conf

      下記の修正を適用します。

      --- httpd.conf.orig     Mon Oct 25 20:19:16 2004
      +++ httpd.conf  Tue Jan 18 00:29:02 2005
      @@ -169,7 +169,10 @@
       LoadModule userdir_module modules/mod_userdir.so
       #LoadModule usertrack_module modules/mod_usertrack.so
       #LoadModule vhost_alias_module modules/mod_vhost_alias.so
       #LoadModule ssl_module modules/mod_ssl.so
      +LoadModule php5_module "c:/php/php5apache2_2.dll"
      +AddType application/x-httpd-php .php
      +PHPIniDir "C:/php"
      
      @@ -318,7 +321,7 @@
       # negotiated documents.  The MultiViews Option can be used for the
       # same purpose, but it is much slower.
       #
      -DirectoryIndex index.html index.html.var
      +DirectoryIndex index.html index.htm index.php index.php5 index.phtml index.html.var
      	

    Apacheサービスの再起動


    Windows「スタート」->「ファイル名を指定して実行」から
    「%SystemRoot%\system32\services.msc /s」を実行し、のApacheサービスにて右クリックから
    再起動を選択・実行します。

      apache2_win32_PHP5_04.png

      apache2_win32_PHP5_04.png

    動作確認


      C:\usr\local\apache\htdocs\index.php として、以下の1行を記載・保存します。

        <? phpinfo(); ?>

      ブラウザで該当サーバへアクセスして、下記の画面が表示されればセットアップ完了です。

        apache2_win32_modssl_PHP5_06.png

    うにっくすさんの覚え書きについて

    Home >> うにっくすさんの覚え書き >> Apache2(Win32) - PHP5