Engineer as a Lifestyle @tenkoma

What We Find Changes Who We Become -- Peter Morville著『アンビエント・ファインダビリティ 』

お手入れ PHP 5.2.8

phpMyAdminを使おうとして、PHPを使おうとして、設定をしていたら、なかなかうまくいかない。

% sudo /opt/local/apache2/bin/apachectl configtest
httpd: Syntax error on line 115 of /opt/local/apache2/conf/httpd.conf: Cannot load /opt/local/apache2/modules/libphp5.so into server: dlopen(/opt/local/apache2/modules/libphp5.so, 10): Library not loaded: /opt/local/lib/libltdl.3.dylib\n  Referenced from: /opt/local/apache2/modules/libphp5.so\n  Reason: image not found

libltdl.3.dylibってのが見つからないとか。

% la /opt/local/lib/libltdl*
/opt/local/lib/libltdl.7.dylib /opt/local/lib/libltdl.dylib
/opt/local/lib/libltdl.a       /opt/local/lib/libltdl.la

確かにない。upgradeだと、Apacheモジュールが更新されない…みたいな現象かな?とりあえず、(依存関係も気にせず)強制アンインストール&再インストールしてみる。

% sudo port -f uninstall php5
--->  Unable to uninstall php5 5.2.8_0+apache2+macosx+mysql5+pcntl+pear+postgresql83+readline+sqlite, the following ports depend on it:
--->    phpmyadmin
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating php5 @5.2.8_0+apache2+macosx+mysql5+pcntl+pear+postgresql83+readline+sqlite
--->  Uninstalling php5 @5.2.8_0+apache2+macosx+mysql5+pcntl+pear+postgresql83+readline+sqlite
% sudo port install php5 +apache2 +mysql5 +pear +readline +pcntl +postgresql83 +sqlite
--->  Fetching php5
--->  Verifying checksum(s) for php5
--->  Extracting php5
--->  Applying patches to php5
--->  Configuring php5
--->  Building php5
--->  Staging php5 into destroot
Warning: php5 requests to install files outside the common directory structure!
--->  Installing php5 @5.2.8_0+apache2+macosx+mysql5+pcntl+pear+postgresql83+readline+sqlite

If this is your first install, you might want
cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so

* copy  /opt/local/etc/php.ini-dist to  /opt/local/etc/php.ini
--->  Activating php5 @5.2.8_0+apache2+macosx+mysql5+pcntl+pear+postgresql83+readline+sqlite
--->  Cleaning php5
% cd /opt/local/apache2/modules
% sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
Password:
[activating module `php5' in /opt/local/apache2/conf/httpd.conf]
% ll libphp5*
-rwxr-xr-x  2 root  admin   6.6M 12 29 07:46 libphp5.so

生成されているっぽい。

% sudo /opt/local/apache2/bin/apachectl configtest
Syntax OK

チェック通った。

% sudo /opt/local/apache2/bin/apachectl restart
% sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

設定終わり。