Forum

iMac OS X 10.5.5

Rene
10 November 2008, 23:24
Hi Hugo,
I see that you improved your installation of Hiawatha 6.10 on a Mac. Still some bugs and questions for that v0.1 version
After installation I did the following:

First I check in a Terminal window with the command: ps -ax if hiawatha is running.
Then I start "Hiawatha webserver" from the "Other" part at "System Preferences":
I will press the button: "Start Hiawatha". After giving my credentials, this will change to "Stop Hiawatha"
Then I check again in the Terminal window with ps -ax
Two processes are running:
* (hiawatha) => this is the window with the "Stop Hiawatha" button
* /usr/sbin/hiawatha

When I press the button "Stop Hiawhata" again, I've to give my credentials, but still it mentions "Stop Hiawatha".
ps -ax still does show /usr/sbin/hiawatha

How do I stop the webserver gracefully?

(For shutting down I did the following:
sudo kill -9 <pid of /usr/sbin/hiawatha> does kill the process.
When I open "System preferences" again, the Hiawatha webserver window still does mention "Stop Hiawatha"...)


The other issue is that I use Eclipse PDT with the PHP Zend debugger for testing the php files (e.g. skeleton). I created the workspace in the Documents part. So my PHP project in that directory (/Users/rene/Documents/workspace/test)

When I change the httpd.conf in /var/hiawatha with "sudo vi httpd.conf" to
WebsiteRoot = /Users/rene/Documents/workspace/test
And I test with a simple index.html in that directory (so no php at the moment), and I restart Hiwatha webserver, I get a 403 error in browser.
The /var/log/hiawatha/error.log mentions the following error:
Mon 10 Nov 2008 21:54:14 +0100|127.0.0.1|/Users/rene/Documents/workspace/test/|access denied via filesystem

From server perspective I can understand that I should use /var/www/hiawahta. But from development/test perspective, I want to use the same directory from my Eclipse IDE, which is in my user space.

How to resolve this issue?

Thanks already for your time,
Rene
Hugo Leisink
10 November 2008, 23:31
Thanks for your feedback. I will look into your problem with the Preference Pane. I'm quite new to Cocoa programming, so it's not weird it's not bugfree yet. It's only version 0.1 In the meantime, use 'kill -15 <hiawatha PID>' in a terminal to shutdown Hiawatha.

About the 'access denied via filesystem': check if all the directories in the path to your workspace are readable by the webserver. Hiawatha under MacOS X runs as user '_www' by default. That user should be able to read files in your WebsiteRoot.
Rene
14 November 2008, 00:50
Got the /Users/rene/Documents/workspace/test to work. Did the following steps, according to www.macosxhints.com/article.php?story=20071224093830773

So I did:
sudo fsaclctl -p /Users/rene/Documents/workspace/test/ -e
sudo chmod +a "www allow search" /Users/rene/Documents/workspace/test
ls -alske
0 drwxr-xr-x 9 rene staff 306 Nov 2 17:18 .
0 drwx------+ 39 rene staff 1326 Nov 12 20:13 ..
0: group:everyone deny delete
0 drwxr-xr-x+ 7 rene staff 238 Nov 10 21:21 test
0: user:_www allow search

Using in the /var/hiawatha/httpd.conf WebsiteRoot = /Users/rene/Documents/workspace/test
http://localhost/index.html works now

And now the php part ... :?
Created the next file; phpinfo.php
<?php
phpinfo();
?>
When I run this from the terminal with: php phpinfo.php, my system does return the expected result:
iRene:hiawatha rene$ php phpinfo.php
phpinfo()
PHP Version => 5.2.6
System => Darwin .... etc...

When I place this file in /var/www/hiawatha and use the next httpd.conf configuration:
Binding {
Port = 80
}
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log
CGIextension = cgi
CGIhandler = /usr/bin/php-cgi:php
WebsiteRoot = /var/www/hiawatha
Hostname = 127.0.0.1
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
StartFile = index.html
ExecuteCGI = yes


And then launch/restart hiawatha to be sure it is active, I get after using http://localhost/phpinfo.php -> 500 - Internal Server Error
Looking at /var/log/hiawatha/error.log:
Thu 13 Nov 2008 23:17:15 +0100|127.0.0.1|/var/www/hiawatha/phpinfo.php|no output

Using CGIhandler = /usr/bin/php5-cgi:php or CGIhandler = /usr/bin/php5-cgi:php5,php didn't help.

So what could be the issue in this case?
Hugo Leisink
14 November 2008, 13:08
Does /usr/bin/php-cgi exist? If so, please tell me the output of '/usr/bin/php-cgi -v'.
Rene
18 November 2008, 22:01
/usr/bin/pgp-cgi does not exists.

When I use:
CGIhandler = /usr/bin/php:php


I do get output wen I use http://localhost/phpinfo.hp, but this is plain text and not html formatted:
System => Darwin imac.local 9.5.0 Darwin Kernel Version 9.5.0: Wed Sep  3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386 i386
Build Date => Jul 17 2008 23:00:49
Configure Command => '/SourceCache/apache_mod_php/apache_mod_php-44.1/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs2=/usr/sbin/apxs' '--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' '--with-mysql-sock=/var/mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-openssl' '--with-xmlrpc' '--with-xsl=/usr' '--without-pear'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => (none)
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => disabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.zlib, https, ftps
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
...
Environment

Variable => Value
GATEWAY_INTERFACE => CGI/1.1
REQUEST_METHOD => GET
REQUEST_URI => /phpinfo.php
SCRIPT_NAME => /phpinfo.php
SCRIPT_FILENAME => /var/www/hiawatha/phpinfo.php
DOCUMENT_ROOT => /var/www/hiawatha
REMOTE_ADDR => 127.0.0.1
SERVER_PORT => 80
SERVER_NAME => 127.0.0.1
SERVER_PROTOCOL => HTTP/1.1
SERVER_SOFTWARE => Hiawatha v6.10
REDIRECT_STATUS => 200
HTTP_SCHEME => http
HTTP_ACCEPT => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_CHARSET => ISO-8859-1,utf-8;q=0.7,*;q=0.7
HTTP_ACCEPT_LANGUAGE => en-us,en;q=0.5
HTTP_HOST => localhost
HTTP_USER_AGENT => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
HTTP_RETURN_CODE => 200
...

Copying the /etc/php.ini.default to /etc/php.ini didn't help.

When I tried the next helloworld.php script:
<?php
echo "Hello world!";
/>

I got again: 500 - Internal Server Error

/var/log/hiawatha/error.log does mention:
Tue 18 Nov 2008 19:58:53 +0100|127.0.0.1|/var/www/hiawatha/helloworld.php|CGI only printed a HTTP header, no content

Now I did the same from my Eclipse PDT environment. In that I use the PHP 5.2.5 (CGI):
/Users/rene/eclipse/plugins/org.zend.php.debug.debugger.macosx_5.2.12.v20071210/resources/php5/php-cgi

Both phpinfo.php and helloworld.php work as expected.

BTW: using this plugin.org.zend..../php-cgi in the httpd.conf didn't work, error 500: no output

Trying to find a php-cgi: sudo find / -name 'php-cgi'
This only returned:
/Users/rene/eclipse/plugins/org.zend.php.debug.debugger.macosx_5.2.12.v20071210/resources/php4/php-cgi
/Users/rene/eclipse/plugins/org.zend.php.debug.debugger.macosx_5.2.12.v20071210/resources/php5/php-cgi

Looks like I just need php-cgi on my iMac. But it just isn't installed by Apple.

Looking further on the iMac, I did found /usr/sbin/php-fcgi. The result of php-fcgi -v is:
PHP-FastCGI v6.10

Reading http://www.hiawatha-webserver.org/howto#5.1, I configured /etc/hiawatha/php-cfgi.conf with:
PidFile = /var/run/php-fcgi.pid
Server = /usr/sbin/php-fcgi ; 127.0.0.1:2005 ; _www


Started the process with: sudo /usr/sbin/php-fcgi -k -c /etc/hiawatha/php-fcgi.conf &
But this process does end immediately.

Und jetzt?
Hugo Leisink
19 November 2008, 10:05
/usr/bin/php is the command line (CLI) version of PHP. You cannot use this with Hiawatha, since it doesn't print HTTP headers. /usr/sbin/php-fcgi is a tool which comes with Hiawatha to start PHP as a FastCGI daemon. It's not PHP!!!

MacOS X doesn't contain the CGI version of PHP. You must download the source of PHP and compile and install it manually. If you use Google, you can find several manuals about how to install PHP under MacOS X.
Hugo Leisink
19 November 2008, 10:12
I've found this following configure parameters you can use for MacOS X:

./configure --prefix=/usr/local/php5 --with-apxs --with-config-file-scan-dir=/usr/local/php5/php.d --with-iconv --with-openssl=/usr --with-zlib=/usr --with-gd --enable-gd-native-ttf --with-libjpeg=/sw --with-libtiff=/sw --with-libpng=/sw --with-jpeg-dir=/sw --with-png-dir=/sw --with-zlib-dir=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-wddx --enable-soap --enable-sqlite-utf8 --enable-ftp --enable-sockets --enable-dbx --enable-dbase --enable-mbstring --enable-calendar --enable-bcmath --with-bz2=/usr --with-curl --with-kerberos=/usr --with-imap=/sw/share/c-client/ --with-imap-ssl=/sw/share/c-client/ --with-iodbc=shared,/usr --with-json=shared --enable-memcache --with-libxml --with-xsl --with-pgsql=/sw --with-pdo-pgsql=/sw --with-pdflib --with-t1lib=/sw --with-gettext --with-ming=/sw --with-mcrypt=/sw --with-mhash=/sw --with-mssql=/usr/local --with-mysql=/sw --with-mysqli --with-pdo-mysql=/sw --with-fbsql
This topic has been closed.