|
Replies
:
33
-
Pages
:
3
[
1
2
3
|
Next
]
-
Last Post
:
Dec 10, 2007 1:56 PM
by: charlie-imac
|
|
|
Posts:
312
Registered:
Nov 24, 2001
|
|
|
|
Suggestions for installing the php GD library in Leopard
Posted:
Oct 27, 2007 11:14 PM
|
|
|
I initially had some problems installing entropy's version of php 5 on Tiger. I have wanted to use php to create drawings on my webpage for a while. Now that Leopard has php 5.2.4, I wanted to renew my efforts to put php drawing commands in my webpages.
Does anyone have a suggestion for how to install the GD libraries in Leopard?
MacBook, Mac Mini 1.42GHz
Mac OS X (10.4.10)
|
|
Posts:
312
Registered:
Nov 24, 2001
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 28, 2007 6:38 PM
in response to: mahongue
|
|
|
I just installed the GD library and its 4 supporting libraries. But I guess now I need to configure php to recognize these libraries. What is the easiest way to do this with Leopard's version of php? Do I have to recompile php? I really don't want to do that. I am hoping there is an easy way.
MacBook, Mac Mini 1.42GHz
Mac OS X (10.4.10)
|
|
Posts:
3,722
Registered:
Sep 16, 2000
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 28, 2007 7:25 PM
in response to: mahongue
|
|
|
Hi--
Do I have to recompile php? I really don't want to do that. I am hoping there is an easy way.
Try running this command in the Terminal:
php -m and look for gd. If it's not there, it's not compiled in. And you'll need to recompile.
You can also create a PHP page with phpinfo(); as the only function. It'll also show you what options are compiled in. Look for --with-gd.
charlie
MacBook Pro
Mac OS X (10.4.10)
|
|
Posts:
312
Registered:
Nov 24, 2001
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 28, 2007 8:19 PM
in response to: Charles Minow
|
|
|
Dear Charles,
When I type in php -m, gd does not come up. It also does not come up when I call phpinfo(). I was afraid about that. So, how do I recompile the php that comes with Leopard?
MacBook, Mac Mini 1.42GHz
Mac OS X (10.4.10)
|
|
Posts:
3
From:
Vancouver, BC
Registered:
Jun 22, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 28, 2007 10:37 PM
in response to: mahongue
|
|
|
Recompiling PHP would involve installing the Developer Tools off the Leopard DVD and downloading the PHP source from php.net.
I wouldn't quite recommend that yet as I have done that and have ended up in a worse situation than when I had started. Basically I downloaded the GD library, libjpeg, libpng libraries, got those installed. Then got the PHP source unzipped and configured with:
./configure --with-zlib --with-jpeg-dir=/usr/local/bin --with-png-dir=/usr/local/bin --with-gd --with-mysql=/usr/local/mysql --with-libxml-dir=/usr/local/lib/python2.5/site-packages --with-curl --with-apxs2
Compiled and installed, but Apache was no longer able to start with the PHP5 module. The error that comes back when I try to start Apache is:
httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture
I'm wondering if PHP is being built in 32bit but Apache in Leopard is 64bit. I can't seem to find any information on this problem.
Macbook Pro 2.16GHz
Mac OS X (10.5)
|
|
Posts:
9
From:
Saint-Petersburg, Russia
Registered:
Oct 28, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 29, 2007 6:13 AM
in response to: cmx
|
|
|
Solution has been found!
The same thing here - after building PHP from source, i get the same error message: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture
I've been able to eliminate the whole problem by recompiling Apache2 from source:
./configure --enable-layout=Darwin --enable-mods-shared=all
make
make install
It's even not necessary to rebuild PHP after that. Just relaunch web sharing in System Preferences > Sharing
I think the problem was in apxs2, which was, i suppose, compiled in universal binary format as shipped in Leopard.
MacBook Pro 17" 2.33 GHz
Mac OS X (10.5)
|
|
Posts:
5
From:
Sweden
Registered:
Oct 30, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 30, 2007 3:15 AM
in response to: mahongue
|
|
|
You'll need to compile PHP from source. No need to download GD as it is built in. However you'll need the libjpeg and libpng libraries.
Get latest Stable SRC:
http://www.ijg.org/files/
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --enable-shared --enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a
Get latest Stable SRC with config script
http://www.libpng.org/pub/png/libpng.html
tar jxvf libpng-1.2.22.tar.bz2
cd libpng-1.2.22
./configure
make
sudo make install
sudo ranlib /usr/local/lib/libpng.a
I use these configure options for PHP. You can omit the MySQL option if you havn't installed it.
./configure --with-zlib --with-gd --with-mysql=/usr/local/mysql --with-apxs2
make
make install
Macbook Pro 2.16 GHz Core2Duo
Mac OS X (10.5)
|
|
Posts:
5
From:
Sweden
Registered:
Oct 30, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 30, 2007 3:18 AM
in response to: Michel L
|
|
|
Oh an don't forget to recompile apache2. Follow genetiqs advice above.
Download source here: http://httpd.apache.org/download.cgi
Macbook Pro 2.16 GHz Core2Duo
Mac OS X (10.5)
|
|
Posts:
3
From:
Vancouver, BC
Registered:
Jun 22, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 30, 2007 2:27 PM
in response to: Michel L
|
|
|
Yeah definitely recompiling Apache is the key here, but I learned that the hard way after recompiling a stupid amount of stuff before completely screwing up libxml.
Eventually gave up trying to fix libxml and re-installed leopard.
All is good now after I re-built everything. Hopefully this thread helps more people.
Macbook Pro 2.16GHz
|
|
Posts:
9
From:
Saint-Petersburg, Russia
Registered:
Oct 28, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 30, 2007 3:23 PM
in response to: cmx
|
|
|
Actually, the good way to compile libxml2 on MacOS X is this:
let's assume that libxml2 source are in /usr/src/libxml2
cd /usr/src/libxml2
env CFLAGS="-O -g -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --with-html-dir=/usr/share/doc --disable-dependency-tracking
make -j3
sudo make install
It will build libxml2 in universal binary format, which is essential for running some Mac OS Classic applications, especially games.
You can use this method to compile many things you may need in future, but some of them will fail to compile in UB without "--disable-dependency-tracking" switch (dunno why, though :))
MacBook Pro 17" 2.33 GHz
Mac OS X (10.5)
|
|
Posts:
312
Registered:
Nov 24, 2001
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 30, 2007 5:42 PM
in response to: genetiq
|
|
|
genetiq,
I am confused, so I don't need to do anything with php? Just use the php provided in leopard?
The steps as I understand them (to get GD working with php) is to...
1. Download apache2 (at http://httpd.apache.org/download.cgi)
2. cd into the httpd-2.2.6 directory
3. type "./configure --enable-layout=Darwin --enable-mods-shared=all" and hit return
4. type "make" and hit return
5. type "make install" and hit return
Then go to Preferences->Sharing and turn on apache
Is that it? Please tell me any other steps I need to follow. Thank you.
MacBook, Mac Mini 1.42GHz
Mac OS X (10.4.10)
|
|
Posts:
9
From:
Saint-Petersburg, Russia
Registered:
Oct 28, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 31, 2007 2:18 AM
in response to: mahongue
|
|
Helpful
|
|
|
Okay, here is the complete instruction on how to do this. Michel L already posted a very good message on how to build PHP with GD enabled, so i just combine all the answers in one step-by-step guide.
1. Download the Apache2 source from http://httpd.apache.org/download.cgi (latest version is 2.2.6) and extract it.
2. Open Terminal and go to that directory. If you extract sources into your Downloads folder, type "cd ~/Downloads/httpd-2.6.6" and hit return
3. Type "./configure --enable-layout=Darwin --enable-mods-shared=all" and hit return
4. Wait for the process to complete and then type "make" and return
5. Wait for the process to complete and then type "sudo make install" and return
Now you have Apache2 built and installed and it should run perfectly.
Then, follow the Michel L instructions. I will copy them here with several modifications:
Install libjpeg ***
Get latest Stable SRC:
http://www.ijg.org/files/
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
env CFLAGS="-O -g -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --enable-shared --enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a
Install libpng ***
Get latest Stable SRC with config script
http://www.libpng.org/pub/png/libpng.html
tar jxvf libpng-1.2.22.tar.bz2
cd libpng-1.2.22
env CFLAGS="-O -g -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc" ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-dependency-tracking
make
sudo make install
sudo ranlib /usr/local/lib/libpng.a
The same procedure with PHP sources, and configure line should look like this:
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-curl --with-gd --enable-exif --enable-fastcgi --enable-zip --with-jpeg-dir=/usr/src/libjpeg --with-ldap=/usr --with-kerberos=/usr --with-zlib=/usr --enable-ftp --enable-sockets --with-iodbc=/usr --with-config-file-path=/etc --with-openssl --with-xmlrpc --with-xsl=/usr
If you have MySQL installed, add the following options to the PHP configure command (let's assume you have your MySQL in /usr/local/mysql directory):
--with-mysql=/usr/local/mysql --with-mysql-sock=/var/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config
Then, run "make -j3"
And then, as usual, "sudo make install"
-
- Note that PHP configure and build processes will take much time even on fast machine.
After all, go to "System Preferences > Sharing" and uncheck "Web Sharing" checkbox, then wait a bit and check it again. Now you should have your Apache+PHP up and running.
MacBook Pro 17" 2.33 GHz
Mac OS X (10.5)
|
|
Posts:
11
From:
UK
Registered:
May 4, 2005
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 31, 2007 10:20 AM
in response to: genetiq
|
|
|
Wouldn't recompiling Apache from source create a duplicate copy of Apache on Leopard, because Apache is in a different location (/usr/sbin/ and /etc/apache2/)?
Is there a way of recompiling Apache to be exactly as the default Leopard installation (just with the proper archs)?
I'm trying to compile SVNServer and I'm getting a similar "wrong arch" error, and I've even tried recompiling OpenSSL with no luck. Some file somewhere must be the wrong arch. Isn't there anybody who could just upload the problem file somewhere from their fixed copy?
MacBookPro
Mac OS X (10.5)
|
|
Posts:
5
From:
Sweden
Registered:
Oct 30, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 31, 2007 10:27 AM
in response to: genetiq
|
|
|
Have you managed to get mod rewrite and symbolic linking to work?
Macbook Pro 2.16 GHz Core2Duo
Mac OS X (10.5)
|
|
Posts:
5
From:
Sweden
Registered:
Oct 30, 2007
|
|
|
|
Re: Suggestions for installing the php GD library in Leopard
Posted:
Oct 31, 2007 10:30 AM
in response to: Joseph Farrow
|
|
|
I think that's what the --enable-layout=Darwin option is for.
Macbook Pro 2.16 GHz Core2Duo
Mac OS X (10.5)
|
|
|