This was way more of a struggle than I was looking for, especially compiling PHP, so I thought I'd share what worked for me in case somebody else runs into the same problems. Initially, I just hoped to update PHP 5.2.9 to 5.3.5, but I immediately ran into issues so I just updated everything. This was all for an effort to get an instance of SugarCRM 6.1.1 running and it would have been easier to just grab their FastStack installers (http://www.sugarcrm.com/crm/download/sugar-suite.html#installers), but I have other PHP/Apache projects I need to support.
Updating to MySQL 5.5.8
Super easy as I had MySQL 5.0.45 installed previously. Just went to http://www.mysql.com/downloads/ and grabbed the tar.gz file. After mysqldump'ing my old databases I simply ran these steps:
sudo mv ~/Downloads/mysql-5.5.8-osx10.6-x86_64.tar.gz /usr/local
cd /usr/local/
sudo tar -xvf mysql-5.5.8-osx10.6-x86_64.tar.gz
sudo ln -s /usr/local/mysql-5.5.8-osx10.6-x86_64 mysql
cd mysql
sudo chown -R _mysql .
sudo chgrp -R _mysql .
scripts/mysql_install_db --user=mysql
sudo chown -R root .
sudo chown -R _mysql data
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql
I then reimported my data by opening a mysql prompt, creating the database, exiting, and then reimporting my data with mysql -u root -p db name < mysqldump file
Installing Apache 2.2.17
I was upgrading from Apache 2.2.5, but I don't use a lot of compiled modules so this was also straightforward. First grab the latest apache at http://httpd.apache.org/download.cgi Then do:
sudo su
mv ~/httpd-2.2.17.tar.gz /usr/local/src
cd /usr/local/src
tar -xvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache2
make
sudo make install
This puts everything in /usr/local/apache2.
Installing PHP 5.3.5
This was the biggy and the reason for this post. I use a number of PHP modules: apxs, mysql, zlib, curl, mbstring, soap, openssl, and iconv. iconv was the initial pain.
Updating iconv
First, get the latest PHP release http://www.php.net/downloads.php. I originally was trying to configure with this (note this is stored in config.nice so I tend to edit that directly rather than typing these long strings on the command line):
./configure' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-mysql=/usr/local/mysql' \
'--enable-mbstring' \
'--with-zlib' \
'--with-iconv=/sw' \
'--with-curl=/sw' \
"$@"
This immediately spit out:
checking for iconv support... yes
checking for libiconv in -liconv... no
checking for iconv in -liconv... no
configure: error: Please reinstall the iconv library.
This config definitely used to work (I have a PHP 5.2.9 install to prove it), but one of the OS updates must have changed something somewhere. I'm pretty sure I previously installed iconv with fink, but I've sort of given up on using it all the time in favor of compiling things myself. I got make to run through by changing '--with-iconv=/sw' to use '--with-iconv=/usr', but then immediately failed with this:
php5.bundle libs/libphp5.so
Undefined symbols:
"_libiconv_open", referenced from:
__php_iconv_strlen in iconv.o
_php_iconv_string in iconv.o
I continued to hunt and peck for awhile and did a bunch of mindless trial and error. Here's what eventually worked for getting through iconv (I had more problems, which I fixed below):
- Download a new iconv at http://www.gnu.org/software/libiconv/#downloading. After getting the software and extracting it I ran:
./configure --prefix=/usr/local
make
make install - I had to manually edit one of PHP's files, "php-5.3.5/ext/iconv/iconv.c" changing
#if defined(HAVE_LIBICONV) && defined(ICONV_ALIASED_LIBICONV)
to
#define iconv libiconv
#endif
#if defined(HAVE_LIBICONV) && defined(ICONV_ALIASED_LIBICONV)
#define iconv iconv
#endif - I then modified the configure to contain '--with-iconv-dir=/usr/local'
This got the iconv portion working, but I immediately ran into library issues with mysql.
Fixing MySQL
Here was my initial error:
libs/libphp5.bundle libs/libphp5.so
Undefined symbols:
"_res_9_dn_expand", referenced from:
_php_parserr in dns.o
_php_parserr in dns.o
This was a linker issue that was solved by making a few additions to the configure command in config.nice:
CFLAGS='-arch x86_64' \
CXXFLAGS='-arch x86_64' \
LIBS='-lresolv' \
'./configure' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-mysql=/usr/local/mysql' \
'--with-iconv=/usr/local' \
'--enable-mbstring' \
'--with-zlib' \
'--with-curl=/sw' \
"$@"
Immediately ran into another error, which was, thankfully, the last hurdle.
libs/libphp5.bundle libs/libphp5.so
Generating phar.phar
dyld: Library not loaded: libmysqlclient.16.dylib
Referenced from: /usr/local/src/php-5.3.5/sapi/cli/php
Reason: image not found
make: *** [ext/phar/phar.phar] Trace/BPT trap
I was able to fix the "make" step by adding "/usr/local/mysql" to my DYDL_LIBRARY_PATH, but "make install" then failed:
Installing PEAR environment: /usr/local/lib/php/
dyld: Library not loaded: libmysqlclient.16.dylib
Referenced from: /usr/local/src/php-5.3.5/sapi/cli/php
Reason: image not found
make[1]: *** [install-pear-installer] Trace/BPT trap
make: *** [install-pear] Error 2
Much more unsuccessful hunting and pecking insued, followed by figuring out the path of mysql shared library was missing. Here was the initial otool output:
$ otool -DX /usr/local/mysql/lib/libmysqlclient.16.dylib
libmysqlclient.16.dylib
Which I fixed by running:
$ sudo install_name_tool -id /usr/local/mysql/lib/libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.dylib
otool then spit out the full path:
$ otool -DX /usr/local/mysql/lib/libmysqlclient.16.dylib
/usr/local/mysql/lib/libmysqlclient.16.dylib
This was the ticket for me. No doubt I glossed over all the root causes of these problems. Don't forget to run make clean. Whew!
You utter star. This post saved my bacon!
ReplyDeleteThe King Casino | Review of Casino | RTP - Joker
ReplyDeleteThe king casino 출장안마 review https://septcasino.com/review/merit-casino/ - everything you need to know about worrione.com this popular https://jancasino.com/review/merit-casino/ casino. It's all about herzamanindir quality and quantity.
There is usually a checkbox that you must tick to decide in for the 바카라 사이트 supply. If you don’t tick this box, may be} principally telling the casino you don’t wish to claim the welcome bonus. Head to the cashier and choose your sign up bonusfrom their choice menu earlier than choosing your deposit technique. This doesn't mean want to|you must} earn $1,000 in wagers, simply that your complete bets have to equal that quantity. If you go up $100 after which down $100, that counts as $200 of bets toward the rollover requirement, so these bonuses are much more attainable than at first glance.
ReplyDelete