Cygwin でPHPのファイルを扱おうとしたら、gd 関連でエラーに成った。
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20100525/gd.dll' - No such file or directory in Unknown on line 0
上記のエラーになった。こういう時はcygcheck でふるいに掛ける。
php のスクリプトをCygwin ApacheやCygwinシェルで動かしてると、エラーが出てくる
php-gd は cygports で入れています。
cygcheck で依存関係を調べる。
takuya@takuya-PC:/tmp$ cygcheck.exe '/usr/lib/php/20100525/gd.dll' C:\Users\Public\Apps\cygwin\lib\php\20100525\gd.dll C:\Users\Public\Apps\cygwin\bin\cygphp5.dll C:\Users\Public\Apps\cygwin\bin\cygcrypto-1.0.0.dll C:\Users\Public\Apps\cygwin\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Heap-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Memory-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Handle-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Synch-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-File-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-IO-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ThreadPool-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-LibraryLoader-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-NamedPipe-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Misc-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-SysInfo-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Localization-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-String-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Debug-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ErrorHandling-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Fibers-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Util-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Profile-L1-1-0.dll C:\Windows\system32\API-MS-Win-Security-Base-L1-1-0.dll C:\Users\Public\Apps\cygwin\bin\cygz.dll C:\Users\Public\Apps\cygwin\bin\cyggcc_s-1.dll C:\Users\Public\Apps\cygwin\bin\cygpcre-1.dll C:\Users\Public\Apps\cygwin\bin\cygssl-1.0.0.dll C:\Users\Public\Apps\cygwin\bin\cygxml2-2.dll C:\Users\Public\Apps\cygwin\bin\cygiconv-2.dll C:\Users\Public\Apps\cygwin\bin\cyglzma-5.dll cygcheck: track_down: could not find cygfreetype-6.dll cygcheck: track_down: could not find cygjpeg-8.dll cygcheck: track_down: could not find cygpng15-15.dll cygcheck: track_down: could not find cygt1-5.dll cygcheck: track_down: could not find cygvpx-1.dll cygcheck: track_down: could not find cygXpm-4.dll
エラーに対処する。
これはlibpngがないエラーと考えられる。
cygcheck: track_down: could not find cygpng15-15.dll
pngライブラリを入れる
takuya@takuya-PC:/tmp$ apt-cyg search libpng Working directory is /setup Mirror is http://ftp.iij.ad.jp/pub/cygwin/ Searching for installed packages matching libpng: Searching for installable packages matching libpng: gstreamer0.10-plugins-libpng gstreamer1.0-plugins-libpng libpng libpng-debuginfo libpng-devel libpng10 libpng10-devel libpng12 libpng12-devel libpng14 libpng14-debuginfo libpng14-devel libpng15
libjpegに関しても同様に。
apt-cyg search jpeg apt-cyg install jpeg
その他のライブラリも検索して該当を探して入れる。
apt-cyg install libvpx1 libfreetype6 libXpm4
淡々と入れていく。
対応結果
takuya@takuya-PC:/tmp$ cygcheck.exe '/usr/lib/php/20100525/gd.dll' C:\Users\Public\Apps\cygwin\lib\php\20100525\gd.dll C:\Users\Public\Apps\cygwin\bin\cygphp5.dll C:\Users\Public\Apps\cygwin\bin\cygcrypto-1.0.0.dll C:\Users\Public\Apps\cygwin\bin\cygwin1.dll C:\Windows\system32\KERNEL32.dll C:\Windows\system32\API-MS-Win-Core-RtlSupport-L1-1-0.dll C:\Windows\system32\ntdll.dll C:\Windows\system32\KERNELBASE.dll C:\Windows\system32\API-MS-Win-Core-ProcessThreads-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Heap-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Memory-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Handle-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Synch-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-File-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-IO-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ThreadPool-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-LibraryLoader-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-NamedPipe-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Misc-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-SysInfo-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Localization-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ProcessEnvironment-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-String-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Debug-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-ErrorHandling-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Fibers-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Util-L1-1-0.dll C:\Windows\system32\API-MS-Win-Core-Profile-L1-1-0.dll C:\Windows\system32\API-MS-Win-Security-Base-L1-1-0.dll C:\Users\Public\Apps\cygwin\bin\cygz.dll C:\Users\Public\Apps\cygwin\bin\cyggcc_s-1.dll C:\Users\Public\Apps\cygwin\bin\cygpcre-1.dll C:\Users\Public\Apps\cygwin\bin\cygssl-1.0.0.dll C:\Users\Public\Apps\cygwin\bin\cygxml2-2.dll C:\Users\Public\Apps\cygwin\bin\cygiconv-2.dll C:\Users\Public\Apps\cygwin\bin\cyglzma-5.dll C:\Users\Public\Apps\cygwin\bin\cygfreetype-6.dll C:\Users\Public\Apps\cygwin\bin\cygbz2-1.dll C:\Users\Public\Apps\cygwin\bin\cygjpeg-8.dll C:\Users\Public\Apps\cygwin\bin\cygpng15-15.dll C:\Users\Public\Apps\cygwin\bin\cygt1-5.dll C:\Users\Public\Apps\cygwin\bin\cygvpx-1.dll C:\Users\Public\Apps\cygwin\bin\cygXpm-4.dll C:\Users\Public\Apps\cygwin\bin\cygX11-6.dll C:\Users\Public\Apps\cygwin\bin\cygxcb-1.dll C:\Users\Public\Apps\cygwin\bin\cygXau-6.dll C:\Users\Public\Apps\cygwin\bin\cygXdmcp-6.dll
これでエラーが消えたら、ちゃんと動くよ。
CygwinのDLL欠如はCygCheckで調べると便利ですね。