#native_company# #native_desc#
#native_cta#

Getting Started with PHP/Ming Page 2

By Iman S. H. Suyoto
on August 10, 2001

Installing PHP/Ming on Debian GNU/Linux

Okay, I’ll use $MINGINST to state Ming
installation directory. For example, in my computer, the
installation directory is /usr/apps/src/ming-0.1.1.
So, if I say $MINGINST/php_ext, it means
/usr/apps/src/ming-0.1.1/php_ext.
My initial (intuitive, again) step was trying to recompile
the source code to get the shared object. The README
stated that the first thing to do was simply typing make
static
. This produced $MINGINST/libming.a and
some object files under $MINGINST/src. Next, still
following the README, I changed directory to
$MINGINST/php_ext and typed make.
Whew… lots of errors. I read the error messages and they were
about header files being not found. Maybe you think that it
shouldn’t be a problem if we have apt-got (err… perfect form
of apt-get…) install php4-dev (for your
information, I’m using the stable version). The fact is: it is,
and it is because of the Debian directory layout that
“confuses” php-config --includes being used inside
Makefile. The same thing also applies for
php-config --extension-dir.

With such a condition, in such a “quick and dirty” way, I
modified Makefile so it became like this:
(includes wrapped for formatting for this example)



prefix=`php-config --prefix`

includes=-I /usr/include/php4/main -I /usr/include/php4/Zend 
-I /usr/include/php4/ext/standard -I /usr/include/php4 
-I /usr/include/php4/TSRM
extension=/usr/lib/php4/apache

DEFINES = -DHAVE_MING -DCOMPILE_DL_MING -DZEND_NEW_ERROR_HANDLING

CFILES = ming.c

php_ming.so: ming.o
	${CC} -shared -fpic ming.o ../libming.a -o php_ming.so -lm

ming.o: ${CFILES}
	${CC} ${DEFINES} -c ming.c -I. -I.. ${includes} 

clean:
	rm -f php_ming.so

install:
	cp php_ming.so ${extension} 
	echo "Don't forget to add 'extension=php_ming.so' to php.ini!"

Please notice the changes: two additional variables
(includes and extension) and a few
changes in the targets ming.o and
install.