# php52 unable to load gd.so - libpng.so.5 not found



## amacleod (Dec 22, 2010)

Hi Guys
      I know there are numerous similar posts to this one but Ive tried all the things I can find and I'm at my wits end. I have been administering our freebsd servers for a number of years but my knowledge of package management is not what it should be so please forgive my ignorance. 

I got myself into a bind following a recent attempt to upgrade php on one of our production webservers. We were running php version 5.2.8 and I updated the ports tree and ran portupgrade on php5 without consulting /usr/ports/UPDATING (i now know that was probably the cause of all the problems). I ran into major issues when apache wouldn't start back up, I was  getting core dumps even when I disabled all the php extension modules. So in a bit of a panic to get the box back up, i deleted all php53 packages and went back to php52 (5.2.14). By installing/enabling all the php modules one at a time I was able to get a functioning box up and running. 

The only module I have cant seem to get working is gd. See error below.


```
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20060613/gd.so' - Shared object "libpng.so.5" not found
```

It seems I have libpng.so.6 installed but not libpng.so.5. Creating a symlink managed to fool apache but we get mysterious errors whenever a gd function is called within php.


```
PHP Warning:  imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open
```

The exact same thing occurs with libjpeg but different version numbers.

Ive tried deleting all png/gd related packages and reinstalling numerous times without success. I also tried to use portdowngrade on the png package as advised in one post but cant seem to get any of the anoncvs servers to respond?? 

Ive got a feeling that the package database has been screwed up during this whole process. Ive gone through pkgdb -F a number of times, but I'm not confident i've corrected everything rightly. I'm not skilled enough to answer all its questions confidently. Is there another way to fix it.      

I am happy to provide any other information you might need in order to assist me.

Any advice would be greatly appreciated.  

Cheers
       Andrew


----------



## amacleod (Dec 22, 2010)

sorry, some more information i should have provided


```
uname -a
FreeBSD 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Feb 19 11:06:47 EST 2007     root@:/usr/obj/usr/src/sys/MYKERNEL  amd64
```


```
php -v
PHP 5.2.14 with Suhosin-Patch 0.9.7 (cli) (built: Dec  2 2010 10:26:36)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
```



```
php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dom
fileinfo
filter
ftp
gd
gettext
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcre
pdf
PDO
pdo_mysql
pdo_sqlite
posix
readline
Reflection
session
SimpleXML
soap
sockets
SPL
SQLite
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
```


```
pkg_info (edited)
GeoIP-1.4.0         Find the country that any IP address or hostname originates
antiword-0.37_1     An application to display Microsoft(tm) Word files
apache+mod_ssl-1.3.41+2.8.31 The Apache 1.3 webserver with SSL/TLS functionality
apache-ant-1.7.0_1  Java- and XML-based build tool, conceptually similar to mak
apr-db42-1.2.8_2    The Apache Group's Portability Library
aspell-0.60.5       Spelling checker with better suggestion logic than ispell
autoconf-2.13.000227_5 Automatically configure source code on many Un*x platforms
autoconf-2.53_3     Automatically configure source code on many Un*x platforms
autoconf-2.59_2     Automatically configure source code on many Un*x platforms
autoconf-2.61_2     Automatically configure source code on many Un*x platforms
autoconf-2.62       Automatically configure source code on many Un*x platforms
autoconf-2.68       Automatically configure source code on many Un*x platforms
autoconf-wrapper-20071025 Wrapper script for GNU autoconf
automake-1.4.6_2    GNU Standards-compliant Makefile generator (1.4)
automake-1.9.6_2    GNU Standards-compliant Makefile generator (1.9)
automake-wrapper-20071025 Wrapper script for GNU automake
bash-3.1.17         The GNU Project's Bourne Again SHell
bison-2.4.3,1       A parser generator from FSF, (mostly) compatible with Yacc
curl-7.16.3         Non-interactive tool to get files from FTP, GOPHER, HTTP(S)
curl-7.21.1         Non-interactive tool to get files from FTP, GOPHER, HTTP(S)
cvsup-without-gui-16.1h_2 General network file distribution system optimized for CVS
cyrus-sasl-2.1.22   RFC 2222 SASL (Simple Authentication and Security Layer)
db42-4.2.52_4       The Berkeley DB package, revision 4.2
diablo-jdk-1.5.0.07.01_9 Java Development Kit 1.5.0_07.01
docbook-xml-4.2_1   XML version of the DocBook DTD
docbook-xml-4.4     DocBook/XML DTD V4.4, designed for technical documentation
docbook-xsl-1.70.1  XSL DocBook stylesheets
expat-2.0.0_1       XML 1.0 parser written in C
fontconfig-2.3.2_6,1 An XML-based font configuration API for X Windows
fop-0.95            Print formatter driven by XSL formatting
freetype2-2.2.1_1   A free and portable TrueType font rendering engine
gdal-1.7.2_1        A translator library for geospatial data formats
gettext-0.14.5_2    GNU gettext package
gmake-3.81_1        GNU version of 'make' utility
imake-6.9.0_1       Imake and other utilities from X.Org
ispell-3.2.06_16    An interactive spelling checker for multiple languages
jasper-1.900.1_9    An implementation of the codec specified in the JPEG-2000 s
javavmwrapper-2.3   Wrapper script for various Java Virtual Machines
jpeg-6b_4           IJG's jpeg compression utilities
jpeg-8_3            IJG's jpeg compression utilities
libX11-1.1.3,1      X11 library
libXau-1.0.3_2      Authentication Protocol library for X11
libXaw-1.0.7,1      X Athena Widgets library
libXdmcp-1.0.2      X Display Manager Control Protocol library
libXext-1.0.3,1     X11 Extension library
libXrender-0.9.5    X Render extension library
libXt-1.0.5         X Toolkit library
libXtst-1.0.3       X Test extension
libdrm-2.0.2        Userspace interface to kernel Direct Rendering Module servi
libgeotiff-1.3.0    Library for reading and writing GeoTIFF information tags
libiconv-1.11_1     A character set conversion library
libmcrypt-2.5.7_2   Multi-cipher cryptographic library (used in PHP)
libtool-1.5.22_3    Generic shared library support script
libtool-2.4         Generic shared library support script
libungif-4.1.4_5    Tools and library routines for working with GIF images
libxml2-2.6.30      XML parser library for GNOME
libxslt-1.1.17      The XSLT C library for GNOME
linux_base-fc-4_9   Base set of packages needed in Linux mode (for i386/amd64)
mhash-0.9.9.9_1     An easy-to-use library for strong hashes such as MD5 and SH
mysql-client-5.0.33 Multithreaded SQL database (client)
mysql-server-5.0.33 Multithreaded SQL database (server)
...
pcre-8.10           Perl Compatible Regular Expressions library
pdflib-7.0.0p3      A C library for dynamically generating PDF
pear-Log-1.9.10     PEAR logging utilities
pecl-fileinfo-1.0.4 A PECL extension to retrieve info about files
pecl-hash-1.5       HASH Message Digest Framework for PHP
pecl-json-1.2.1     PHP extension for JSON (JavaScript Object Notation) seriali
pecl-pdflib-2.1.8   A PECL extension to create PDF on the fly
pecl-zip-1.9.0      A PECL extension to create and read zip files
perl-5.8.8          Practical Extraction and Report Language
php52-5.2.14_1      PHP Scripting Language
php52-bcmath-5.2.14_1 The bcmath shared extension for php
php52-bz2-5.2.14_1  The bz2 shared extension for php
php52-calendar-5.2.14_1 The calendar shared extension for php
php52-ctype-5.2.14_1 The ctype shared extension for php
php52-curl-5.2.14_1 The curl shared extension for php
php52-dom-5.2.14_1  The dom shared extension for php
php52-extensions-1.3_1 A "meta-port" to install PHP extensions
php52-filter-5.2.14_1 The filter shared extension for php
php52-ftp-5.2.14_1  The ftp shared extension for php
php52-gd-5.2.14_1   The gd shared extension for php
php52-gettext-5.2.14_1 The gettext shared extension for php
php52-iconv-5.2.14_1 The iconv shared extension for php
php52-mbstring-5.2.14_1 The mbstring shared extension for php
php52-mcrypt-5.2.14_1 The mcrypt shared extension for php
php52-mhash-5.2.14_1 The mhash shared extension for php
php52-mysql-5.2.14_1 The mysql shared extension for php
php52-mysqli-5.2.14_1 The mysqli shared extension for php
php52-openssl-5.2.14_1 The openssl shared extension for php
php52-pcre-5.2.14_1 The pcre shared extension for php
php52-pdo-5.2.14_1  The pdo shared extension for php
php52-pdo_mysql-5.2.14_1 The pdo_mysql shared extension for php
php52-pdo_sqlite-5.2.14_1 The pdo_sqlite shared extension for php
php52-posix-5.2.14_1 The posix shared extension for php
php52-pspell-5.2.14_1 The pspell shared extension for php
php52-readline-5.2.14_1 The readline shared extension for php
php52-recode-5.2.14_1 The recode shared extension for php
php52-session-5.2.14_1 The session shared extension for php
php52-simplexml-5.2.14_1 The simplexml shared extension for php
php52-soap-5.2.14_1 The soap shared extension for php
php52-sockets-5.2.14_1 The sockets shared extension for php
php52-spl-5.2.14_1  The spl shared extension for php
php52-sqlite-5.2.14_1 The sqlite shared extension for php
php52-tidy-5.2.14_1 The tidy shared extension for php
php52-tokenizer-5.2.14_1 The tokenizer shared extension for php
php52-wddx-5.2.14_1 The wddx shared extension for php
php52-xml-5.2.14_1  The xml shared extension for php
php52-xmlreader-5.2.14_1 The xmlreader shared extension for php
php52-xmlrpc-5.2.14_1 The xmlrpc shared extension for php
php52-xmlwriter-5.2.14_1 The xmlwriter shared extension for php
php52-xsl-5.2.14_1  The xsl shared extension for php
php52-zip-5.2.14_1  The zip shared extension for php
php52-zlib-5.2.14_1 The zlib shared extension for php
phpMyAdmin-3.3.8    A set of PHP-scripts to manage MySQL over the web
pkg-config-0.22     A utility to retrieve information about installed libraries
png-1.4.3           Library for manipulating PNG images
proj-4.7.0          Cartographic Projections library
...
```


----------



## DutchDaemon (Dec 22, 2010)

Symlinking library versions is not the way to do it. Looks like you'll need to do this (and maybe other entries from this file) :

[cmd=]less +/^20100328: /usr/ports/UPDATING[/cmd]


----------



## amacleod (Dec 23, 2010)

*Problem solved*

Many many Thanks!! 

Following the instructions in "updating" I ran:


```
portupgrade -rf graphics/png
portupgrade -rf graphics/jpeg
```

All seems to be back in order now.


----------

