liip / build-entropy-php

Entropy PHP forked from ebi, customized for local.ch
86 stars 13 forks source link

iconv #12

Open chruldt opened 9 years ago

chruldt commented 9 years ago

Got an error on macosx server 10.6.8 when trying to use mysql:

httpd: Syntax error on line 144 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _libiconv\n Referenced from: /usr/local/php5/lib/libintl.8.dylib\n Expected in: /usr/lib/libiconv.2.dylib\n in /usr/local/php5/lib/libintl.8.dylib

There is some discussion at https://github.com/liip/php-osx/issues/3 but the link to the answer returns 404 :-(

Is the answer to replace Apple's iconv? Using --prefix /usr or is the (guessed) default /usr/local OK?

chregu commented 9 years ago

which php version are you trying to install?

chruldt commented 9 years ago

5.5 and then 5.4, same error. phpinfo() shows everything as expected, it's just when trying to use mysql mysql_pconnect if I recall correctly...

chregu commented 9 years ago

It's a little bit hard to debug. Do you have a reproducible, small as possible script. I can't see anything wrong in the first place

chruldt commented 9 years ago

It was a production server so I had to back out, but all wordpress sites (3.x) stopped working with the same error, and all uses mysql...

I think the code below should do it...:

<?php $dbuser = 'webuser'; $dbpass = 's3cr3t'; $dbhost = 'localhost'; $dbh = mysql_pconnect($dbhost,$dbuser,$dbpass); mysql_select_db($db, $dbh);
?>

chregu commented 9 years ago

So you didn't have this error with older versions of php-osx? Then it's really strange, since not much changed

I just tried it on my OS X Server 10.6 and it works fine there without that error

chruldt commented 9 years ago

This server har been running Apple's php so far (or so I believe...) Could /usr/lib/libiconv.2.dylib be messed up? The file exists, but there is no (AFAIK) ldd on mac...

chregu commented 9 years ago

There's otool instead of ldd on mac (but you need xcode installed) and it looks like this on my machine

$ otool -L /usr/local/php5/libphp5.so 
/usr/local/php5/libphp5.so:
    /usr/lib/libaprutil-1.0.dylib (compatibility version 4.0.0, current version 4.9.0)
    /usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0)
    /usr/local/php5/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0)
    /usr/lib/libapr-1.0.dylib (compatibility version 4.0.0, current version 4.8.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
    /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/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /usr/local/php5/lib/libtidy-0.99.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 41.1.0)
    /usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.18.0)
    /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0)
    /usr/local/php5/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0)
    /usr/local/php5/lib/libpng12.0.dylib (compatibility version 51.0.0, current version 51.0.0)
    /usr/local/php5/lib/libjpeg.7.dylib (compatibility version 8.0.0, current version 8.0.0)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /usr/local/php5/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
    /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 40.0.0)
    /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 5.0.0)
    /usr/local/php5/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.22.0)
    /usr/lib/libiodbcinst.2.dylib (compatibility version 4.0.0, current version 4.18.0)
chruldt commented 9 years ago

I got this:

t# otool -L /usr/local/php5/libphp5.so /usr/local/php5/libphp5.so: /usr/lib/libaprutil-1.0.dylib (compatibility version 4.0.0, current version 4.9.0) /usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 7.2.0) /usr/local/php5/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0) /usr/lib/libapr-1.0.dylib (compatibility version 4.0.0, current version 4.8.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/local/php5/lib/libtidy-0.99.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 41.1.0) /usr/lib/libiodbc.2.dylib (compatibility version 4.0.0, current version 4.18.0) /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0) /usr/local/php5/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0) /usr/local/php5/lib/libpng12.0.dylib (compatibility version 51.0.0, current version 51.0.0) /usr/local/php5/lib/libjpeg.7.dylib (compatibility version 8.0.0, current version 8.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/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5) /usr/local/php5/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0) /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 40.0.0) /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 5.0.0) /usr/local/php5/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.22.0) /usr/lib/libiodbcinst.2.dylib (compatibility version 4.0.0, current version 4.18.0)

chruldt commented 9 years ago

But I don't se libiconv there...

chruldt commented 9 years ago

And, just for reference:

otool -L /usr/lib/libiconv.dylib

/usr/lib/libiconv.dylib: /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

chregu commented 9 years ago

4th line.. ;)

I really don't see the difference and what could be wrong here.

chruldt commented 9 years ago

Ah, bur the error says: Symbol not found: _libiconv\n Referenced from: /usr/local/php5/lib/libintl.8.dylib\n Expected in: /usr/lib/libiconv.2.dylib\n in Seems it tries to use the system iconv rather than the bundled... How may I coerce it not to?

chregu commented 9 years ago

But even this references to the correct iconv in my case

snowleopard:~ chregu$ otool -L /usr/local/php5/lib/libintl.8.dylib
/usr/local/php5/lib/libintl.8.dylib:
    /usr/local/php5/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0)
    /usr/local/php5/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0)

Did you try setting LD_LIBRARY_PATH to export LD_LIBRARY_PATH=/usr/local/php5/lib:$LD_LIBRARY_PATH before starting apache?

chruldt commented 9 years ago

Nope, I didn't, will try that the next service window...

Seems I get the same...

otool -L /usr/local/php5/lib/libintl.8.dylib

/usr/local/php5/lib/libintl.8.dylib: /usr/local/php5/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.1.0) /usr/local/php5/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0)