前回の記事で、GoogleAppEngineで動くアプリケーションを作るための準備を行いましたが、
実際にPHPを動かしたいと思います。
下記に色々書いてますが、結構苦労しました。
色んなサイトを参考にしながらやってみましたが、バージョンが違う事だと思うのですが、
みなさんのようにすんなりとは動かなかったというのが印象です。
ちなみに最新バージョンで動かすに至らず、ひとつ前のバージョンで動かしてます。
前回の記事はこちら。。
http://studynet.blog54.fc2.com/blog-entry-102.html
Quercusのダウンロードと取り込み
Quercus はPure Javaのオープンソースの PHP 5 エンジンです。
http://quercus.caucho.com/
上記より「quercus-4.0.8.war」をダウンロードしました。
ダウンロードしたファイルを解凍して、「quercus-4.0.8\WEB-INF\lib」の中にあるjarファイル全てをGAE環境上の「war\WEB-INF\lib」にコピーします。
appengine-web.xmlの修正
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application></application>
<version>1</version>
<threadsafe>true</threadsafe>
<!-- Configure serving/caching of GWT files -->
<static-files>
<exclude path="/**.php" />
<include path="**" />
<include path="**.nocache.*" expiration="0s" />
<include path="**.cache.*" expiration="365d" />
<exclude path="**.gwt.rpc" />
</static-files>
<resource-files>
<include path="/**.php" />
</resource-files>
<!-- Configure java.util.logging -->
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
web.xmlの修正
<?xml version="1.0" encoding="UTF-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>Quercus Servlet</servlet-name>
<servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
<init-param>
<param-name>script-encoding</param-name>
<param-value>MS932</param-value>
</init-param>
<init-param>
<param-name>ini-file</param-name>
<param-value>WEB-INF/php.ini</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Quercus Servlet</servlet-name>
<url-pattern>*.php</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>index.php</welcome-file>
</welcome-file-list>
<servlet>
php.iniの作成
war\WEB-INFに「php.ini」ファイルを作成します。
unicode.semantics=on
unicode.http_input_encoding=MS932
unicode.output_encoding=Windows-31J
unicode.runtime_encoding=MS932
index.phpの作成
phpinfo();
?>
以上で設定は完了です。
後は、プロジェクトを右クリックして「実行」→「Webアプリケーション」をクリックします。
無事起動が終わったら、「http://localhost:8888/index.php」にアクセスすることでphpinfoの情報が見れればOKです。



COMMENTS