PHP-Cli Built-in web server RFC
moriyoshiさんがトンでもないを事をやろうとしているようです。すげぇ!
パッチはtrunkを対象にしているようだったのでtrunkで確認。
久々に試して遊んでみようと思ってビルドしてみたら。。。Undefined symbol で遊ぶ事ができませんでした。お前はもう遊ぶな!って事かしら。_| ̄|○
% cd /usr/local/src % gzip -dc ./gist835698-b07dd229da2ebd9fdc03297a1a1dfd2082853d0b.tar.gz | tar xf - % gzip -dc ./php-trunk-201103030130.tar.gz | tar xf - % cd ./php-trunk-201103030130 % patch -p0 < ../gist835698-b07dd229da2ebd9fdc03297a1a1dfd2082853d0b/php-embedded-server-20110220.patch.diff patching file sapi/cli/config.w32 patching file sapi/cli/php_http_parser.c patching file sapi/cli/config.m4 patching file sapi/cli/php_cli_server.c patching file sapi/cli/php_http_parser.h patching file sapi/cli/php_cli_server.h patching file sapi/cli/php_cli.c patching file main/network.c patching file main/php_main.h patching file main/php_network.h % ./configure --without-iconv --disable-all % make [Solaris(sparc)] Undefined first referenced symbol in file cli_server_sapi_module sapi/cli/php_cli.o do_cli_server sapi/cli/php_cli.o ld: fatal: Symbol referencing errors. No output written to sapi/cli/php [Linux(x86)] sapi/cli/php_cli.o: In function `main': /usr/local/src/php-trunk-201103030130/sapi/cli/php_cli.c:1347: undefined reference to `do_cli_server' /usr/local/src/php-trunk-201103030130/sapi/cli/php_cli.c:1297: undefined reference to `cli_server_sapi_module' collect2: ld returned 1 exit status % uname -a SunOS ***** 5.10 Generic_127111-05 sun4v sparc SUNW,Sun-Fire-T200 Solaris % gcc -v Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs Configured with: /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) % uname -a Linux ***** 2.6.18-6-686 #1 SMP Fri Feb 19 23:40:03 UTC 2010 i686 GNU/Linux % gcc -v Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=i686 i486-linux-gnu Thread model: posix gcc version 3.4.6 (Debian 3.4.6-5)
gccが化石だから。。。か?後でMac OS Xで確認してみよっと。
で、Mac OS Xで確認しても同じエラーだったのですが「./buildconf --forceしろ!」って神のお告げがあったので、その通りにしたら全ての環境でビルドが通りました!わーい。これで遊べる。
って、よくよく考えてみるとm4ファイルを変更しているのだから「./buildconf --force」は必要だったね。。。_| ̄|○
% cd /usr/local/src % rm -rf ./php-trunk-201103030130 % gzip -dc ./gist835698-b07dd229da2ebd9fdc03297a1a1dfd2082853d0b.tar.gz | tar xf - % gzip -dc ./php-trunk-201103030130.tar.gz | tar xf - % cd ./php-trunk-201103030130 % patch -p0 < ../gist835698-b07dd229da2ebd9fdc03297a1a1dfd2082853d0b/php-embedded-server-20110220.patch.diff patching file sapi/cli/config.w32 patching file sapi/cli/php_http_parser.c patching file sapi/cli/config.m4 patching file sapi/cli/php_cli_server.c patching file sapi/cli/php_http_parser.h patching file sapi/cli/php_cli_server.h patching file sapi/cli/php_cli.c patching file main/network.c patching file main/php_main.h patching file main/php_network.h % ./buildconf --force % ./configure --without-iconv --with-libxml-dir=/usr --enable-mbstring % make % su # sapi/cli/php -S localhost:4649 Server is listening on localhost:4649... Press CTRL-C to quit. [Thu Mar 3 11:58:55 2011] 127.0.0.1:59253: / [Thu Mar 3 11:58:55 2011] 127.0.0.1:59253: / - No such file or directory [Thu Mar 3 11:58:55 2011] 127.0.0.1:59253: / - Sending error page (404) % uname -a SunOS ***** 5.10 Generic_127111-05 sun4v sparc SUNW,Sun-Fire-T200 Solaris % gcc -v Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs Configured with: /gates/sfw10/builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared Thread model: posix gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath) % uname -a Linux ***** 2.6.18-6-686 #1 SMP Fri Feb 19 23:40:03 UTC 2010 i686 GNU/Linux % gcc -v Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=i686 i486-linux-gnu Thread model: posix gcc version 3.4.6 (Debian 3.4.6-5) % uname -a Darwin ***** 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 % gcc -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5664~105/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5664)
異なるターミナルから以下を実行して確認。
% telnet localhost 4649 Trying 127.0.0.1... Connected to localhost.localdomain. Escape character is '^]'. GET / HTTP/0.9 404 Not Found Connection: closed Content-Type: text/html; charset=UTF=8 Content-Length: 1145 <html><head><title>404 Not Found</title><style type="text/css"> body {background-color: #ffffff; color: #000000;} body, td, th, h1, h2 {font-family: sans-serif;} pre {margin: 0px; font-family: monospace;} a:link {color: #000099; text-decoration: none; background-color: #ffffff;} a:hover {text-decoration: underline;} table {border-collapse: collapse;} .center {text-align: center;} .center table { margin-left: auto; margin-right: auto; text-align: left;} .center th { text-align: center !important; } td, th { border: 1px solid #000000; font-size: 75%; vertical-align: baseline;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccccff; font-weight: bold; color: #000000;} .h {background-color: #9999cc; font-weight: bold; color: #000000;} .v {background-color: #cccccc; color: #000000;} .vr {background-color: #cccccc; text-align: right; color: #000000;} img {float: right; border: 0px;} hr {width: 600px; background-color: #cccccc; border: 0px; height: 1px; color: #000000;} </style> </head><body><h1 class="h">Not Found</h1><p>The requested resource / was not found on this server.</p></body></html>Connection closed by foreign host. %