我試圖建立我的新電腦有此配置的PHP:PHP沒有連接MySQL的共享庫上正確建立
export MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" LIBS=-lresolv
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib
./configure --prefix=/usr/local --with-apxs2=/usr/sbin/apxs --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-openssl=/usr --with-xmlrpc --with-xsl=/usr --without-pear --with-libxml-dir=/usr --with-iconv=/usr/local --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-gd --with-jpeg-dir=/usr/local/Cellar --with-png-dir=/usr/X11 --with-freetype-dir=/usr/X11 --with-mcrypt=/usr/local/Cellar --enable-pcntl
的配置運行正常,但是當我嘗試運行「make」在這次錯誤結束:
Generating phar.phar
dyld: Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/mdiamond/Downloads/php-5.3.8/sapi/cli/php
Reason: image not found
make: *** [ext/phar/phar.phar] Trace/BPT trap: 5
這是很奇怪的,考慮到我指定的「出口DYLD_LIBRARY_PATH =在/ usr /本地/ MySQL的/ lib目錄」和libmysqlclient.18.dylib是在這條道路。看起來鏈接器正在尋找沒有路徑的libmysqlclient.18.dylib(在根目錄中?)。我也跑otool我的PHP程序,並得到這個:
/usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.13.0)
/usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.18.0)
libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
/usr/local/lib/libmcrypt.4.dylib (compatibility version 9.0.0, current version 9.8.0)
/usr/local/lib/libltdl.7.dylib (compatibility version 11.0.0, current version 11.0.0)
/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/X11/lib/libfreetype.6.dylib (compatibility version 13.0.0, current version 13.2.0)
/usr/X11/lib/libpng15.15.dylib (compatibility version 17.0.0, current version 17.0.0)
/usr/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/local/lib/libjpeg.8.dylib (compatibility version 12.0.0, current version 12.0.0)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 46.0.0)
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 46.1.0)
/System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 6.0.0)
/usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.24.0)
注意的libmysqlclient是如何不帶路徑的唯一庫。有誰知道我能如何解決這個問題?我運行的配置錯了嗎?