Pukiwiki でメモしたデータがあるので Mac Mini M2 に持っていく。
PukiWiki は PHP のアプリケーションであるため、PHP を動かさなければならない。
- Mac Mini M2 で Apacheを動かした時、PHPがサポートされていないので CGI で動かす設定をしたが、これだけではだめなようなので、結局、PHP をインストールした。
- インストールした PHPは「署名して認証」しないと動かなかった。
- PukiWiki は最新版にアップデートする必要があった。
PHP インストール
$ brew install php
...
$ To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/opt/homebrew/etc/php/8.2/
To start php now and restart at login:
brew services start php
httpd.conf を編集したが、エラーがでている。
$ apachectl configtest
[Fri Feb 24 20:46:41.855315 2023] [so:error] [pid 13516]
AH06665: No code signing authority for module
at /opt/homebrew/opt/php/lib/httpd/modules/libphp.so specified in LoadModule directive.
apachectl restart したが
phpinfo() も動かない。Apache のエラーログを見たところ、error が吐かれている。
$ cat /private/var/log/apache2/error_log
'/opt/homebrew/Cellar/php/8.2.3/lib/php/20220829/opcache.so' not valid
for use in process: mapped file has no Team ID and is not a platform binary
(signed with custom identity or adhoc?)), ....
署名して認証
~/Library/Keychains に login.keychain-db ファイルを確認して codesign を実行。
$ codesign --sign "myCA" --force --keychain ~/Library/Keychains/login.keychain-db \
/opt/homebrew/opt/php/lib/httpd/modules/libphp.so
httpd.conf に署名。
LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so "myCA"
PukiWki
phpinfo() は動いたが、PukiWiki は動かない。
index.php の error_reportting(E_ALL) をコメントアウトしたところ
<?php
// PukiWiki - Yet another WikiWikiWeb clone.
// $Id: index.php,v 1.9 2006/05/13 07:39:49 henoheno Exp $
// Copyright (C) 2001-2006 PukiWiki Developers Team
// License: GPL v2 or (at your option) any later version
// Error reporting
//error_reporting(0); // Nothing
error_reporting(E_ERROR | E_PARSE); // Avoid E_WARNING, E_NOTICE, etc
//error_reporting(E_ALL); // Debug purpose