MacOS & PHP Daantje on 27 Feb 2005 11:03 pm
PHP-GTK on MacOS X
1st try:
I’m building a project timer app in PHP with the php_gtk.so module. But I can’t compile it for my Mac… I have it running on my linux based machine, but not on my mac yet… I’ve found these pre-compiled libs, but it still doesn’t work…
I’m now checking the Fink stuff… I think I miss some GTK lib…
2nd try:
Found the gtk lib, but still no luck… If someone has an idea, please post!. I always get this error when I fire up a php-gtk script:
3th try “EUREKA! It works!”:
I have it working! This is what I did… I’ve downloaded the latest source from php.net. Unpaked it and compiled it with this configuration:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2 --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc
Do a make and make install command to update the existing php binary.
Now download the latest php-gtk source and compile it.
./buildconf ./configure make make install
Now you should have this file: /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk
rename the php_gtk to php_gtk.so
mv /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk.so
Make sure that the file is executable;
chmod +x /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk.so
Okay now your done… Don’t edit the php.ini to use the php_gtk.so at startup, or else you can’t use php in your Apache webserver! Use the php_gtk.so with this line in your source: dl(’php_gtk.so’);
To get it to work,
start up X11 (This is very important! php-gtk needs X11 or Xdarwin to run or else you get this error:
Fatal error: php-gtk: Could not open display in php-gtk-1.0.1/test/hello.php on line 4)
Xdarwin comes with Fink, a package management system for MacOS X based on the Debian apt tools.
Start your file in the terminal of X11 or Xdarwin and open a bottle of beer!
Leave a Reply
You must be logged in to post a comment.