PHP5, Apache2, Leopard

Bjarne D Mathiesen macintosh at mathiesen.info
Wed Dec 5 00:07:37 PST 2007


Chris Janton wrote:
> Hi
> 
> I have a newly-Leopardized PowerPC running Leopard (10.5.1)
> Fresh install of MacPorts
> Fresh install of XCode 3
> 
> I do this
> 
> sudo port selfupdate
> port version
> Version: 1.520
> 
> On my other systems (PPC 10.3.9, Intel 10.4.11) I used this command to
> install PHP5
> 
>     sudo port install php5 +apache +macosx +mysql5 +pear
> 
> On Leopard I would prefer to use the Apple installed Apache2, so I
> assume that this command would be appropriate
> 
>     sudo port install php5 +apache2 +macosx +mysql5 +pear
> 
...
> 
> So, does anyone have a handy list of hints for making PHP5 work with the
> Apple-provided Apache2?
> I got mysql5 installed and working just fine.
> 
> Thanks in advance.

Ryan Schmidt gave you some reasoning.

Now, if you _do_ want to try and use the Apple version of Apache 2.2.6
in concert with the macports PHP5 you'll have to modify the php5
Portfile. My suggestion is as follows:

In Terminal, execute the following two commands:
export EDITOR=/Applications/TextEdit.app/Contents/MacOS/TextEdit
sudo port edit php5

You'll now have to change the Portfile in TextEdit in two places:
1)
# Build an Apache 2 module. Keep the options here in sync with those in the
# relevant part of the post-destroot phase.
variant apache2 conflicts apache {
	destroot.violate_mtree yes
	configure.args-append \
		--with-apxs2=/usr/sbin/apxs
}
2)
	# Copy the Apache 2 module.
	if { [variant_isset apache2] } {
		xinstall -m 755 ${worksrcpath}/libs/libphp5.so
/usr/libexec/apache2/lib_php5.so
	}

Save, and quit TextEdit.

Please note that I've _!NOT!_ tested this and that it might fail
horribly ;-) Likewise, I don't intend to test it either. ;-)

Also note, that the php5 Portfile will revert to the original each time
you execute a 'port sync'

I'm keeping the Apple PHP5 *.so module, so you can switch between the
Apple and the macports versions at yuor own discretion. I assume you
know how to enable PHP5 manually in httpd.conf :-)


> 
> 8)
> ----------------------------------
> Chris Janton  - face at CentosPrime dot COM
> Netminder for Opus1.COM
> 


-- 
Bjarne D Mathiesen
K¯benhavn N ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$/Intel-frit milj¯
MacOS X 10.4.2 Tiger ; Seamonkey 1.1a ; PowerPC G4 800MHz
                                       http://mozilla.mathiesen.info/
                                       http://webadmin.mathiesen.info/


More information about the macports-users mailing list