How to add PHP to Hiawatha server?

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

PHP works localhost but not via real IP

#16 Post by growler »

The file /etc/hiawatha/httpd.conf contains the configuration of hiawatha. The standard config contains only one VirtualHost section for localhost. If you wish to connect using urls containing different host info then you need to add additional VirtualHost sections into you config file.

Hiawatha will not work with http://127.0.0.1/ either until you add another section

Code: Select all

VirtualHost {
	Hostname = 127.0.0.1
	WebsiteRoot = /root/httpd/hiawatha
	StartFile = index.php
	ExecuteCGI = yes
	FastCGI = PHP5
}
and for your example another virtual host for 192.168.1.9

Code: Select all

VirtualHost {
	Hostname = 192.168.2.9
	WebsiteRoot = /root/httpd/hiawatha
	StartFile = index.php
	ExecuteCGI = yes
	FastCGI = PHP5
}
or course if you have your external ip mapped to a real domain you need to have a Hostname = myrealdomain.com
so that hiawatha will process urls using that http://myrealdomain.com

Another trap I learned was that you can only have one VirtualHost section for the same hostname - seems obvious now but a different configuration for the same hostname will not be processed - only the first listed VirtualHost section is used

gammagone
Posts: 21
Joined: Wed 19 Nov 2008, 12:12

#17 Post by gammagone »

this is a great package
it's something i've been wanting
but i need help - i don't really know how to code - just guessing at it

with it auto starting at boot i click on
Menu -> Personal -> PPLog personal log
and it doesn't know hiawatha is already running
and if i click start it gives the error message

i changed two things in usr/sbin/pplog_gui

(1)
if [ "`echo "$PSSTATUS" | grep ' hiawatha'`" = "" ];then
took out space before hiawatha
if [ "`echo "$PSSTATUS" | grep 'hiawatha'`" = "" ];then

now when i click pplog i get a 404, so i do

(2)
exec defaulthtmlviewer http:127.0.0.1:80/blog/pup_pplog.pl
change to
exec defaulthtmlviewer http://localhost/blog/pup_pplog.pl

this seems to fix the conflict but it doesn't really give me all i want
and maybe going in the wrong direction?
i know how to stop the auto start
but i'd really love a menu item to start and stop hiawatha php
and mysql when i want to

i'll keep trying on my own but it may be a while, if ever

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

Hiawatha On an Off Script

#18 Post by growler »

This is my fault - I did not consider BK's PPLOG script to start Hiawatha - cos I always want to have it going. If you don't want to have hiawatha started at boot time then move the script /etc/init.d/rc.httpd from its current location to somewhere else or ditch it althogether - also my .pet starts mysql too - the same would apply to /etc/init.d/rc.mysqld.

You can then use BK's scripts to start and stop Hiawatha. Your fix to take out the space in front of hiawatha is necessary since I was running it using the full path - if my rc.httpd script is not used then hiawatha is started without the full path and BKs script to stop it works again.

Also, if you wish to use PPLOG then you can browse happily over to

http://localhost/blog/pup_pplog.pl

to run the blog. You don't need to run it from the short cut on the menu - perhaps a bookmark in your browser.

One potential pit-fall is that /etc/init.d/rc.httpd starts the fastcgi php daemons - BKs script doesn't since PHP is not in the standard puppy. Perhaps the thing is to just move this script out of /etc/init.d/ to say /root/my-applications/

then call it manually:

/root/my-applications/rc.httpd start

to start hiawatha and PHP daemons and

/root/my-application/rc.httpd stop

to stop hiawatha and PHP daemons.

awatar100
Posts: 3
Joined: Mon 16 Mar 2009, 09:45

#19 Post by awatar100 »

I dont know why but in my puppy i have to config firewall also so vhost work

tcubed
Posts: 2
Joined: Mon 23 Mar 2009, 18:50

clean the pids when stopping Hiawatha

#20 Post by tcubed »

Hello-
I have 2.6.21.7; maybe this is already taken care of in the latest release.

In /etc/init.d/rc.httpd, I had to add

Code: Select all

rm -f /var/run/php-fcgi.pid
to the stop section.

HTH

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

new LAMP pet

#21 Post by growler »

I re-rolled the LAMP pet including the latest:

mysql 5.1.31
php 5.2.8
hiawatha 6.11
phpMyAdmin 3.1.3.1

I figured that it would be best to keep with the LAMP name since although Apache is not involved it is for good reason - Hiawatha web-server has better speed/security and more efficient memory usage - it does the same job (but better :D) and the LAMP platform/acronym is widely understood.

see

http://www.puppylinux.org/wiki/software ... h-hiawatha

(link updated for rejig of the wiki)

@tcubed:
In /etc/init.d/rc.httpd, I had to add
Code:
rm -f /var/run/php-fcgi.pid

to the stop section.
the line in the /etc/init.d/rc.httpd script /usr/sbin/php-fcgi -k is meant to kill all the daemons and remove the .pid?? I tested this and it seems to work. Perhaps you un-installed the pet without stopping the server and left it orphaned?
Last edited by growler on Wed 06 May 2009, 04:54, edited 1 time in total.

tcubed
Posts: 2
Joined: Mon 23 Mar 2009, 18:50

php-fcgi start/stop logic

#22 Post by tcubed »

Perhaps you un-installed the pet without stopping the server and left it orphaned?
Definitely it was an orphan PID situation. My testing was unsystematic, I'm afraid. I wanted to get Hiawatha and PHP, etc up without intervention, following an abrupt power cycle. I noted that the PHP server would not start if any php-fcgi.pid existed. I was going to add the rm command to the "start" section, but it seemed to fix the problem when in the "stop" section. So I left it there.

The problem of what exactly gets accomplished in a loss-of-power scenario is a subtle one. You have got me curious now. I'm motivated to do a bit more experimenting.

Appreciate your help.

daniel.walmsley
Posts: 1
Joined: Fri 17 Apr 2009, 02:38
Location: Palmy North

php not starting

#23 Post by daniel.walmsley »

Hey I have just installed the pet for the new lamp setup and I cant seem to get php working when I got to phpMyadmin/index.php I see just the text inside the php file. I know you must need more info but im a bit of a noob to linux sorry.

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

More info please

#24 Post by growler »

Please could you list:

1. The version of puppy you are using
2. The full name of the .pet you installed

Thanks

Gill_Baits
Posts: 22
Joined: Sat 25 Aug 2007, 14:10

Re: php not starting

#25 Post by Gill_Baits »

!
Last edited by Gill_Baits on Sat 05 Dec 2009, 07:53, edited 1 time in total.

SVanguardPH2
Posts: 8
Joined: Wed 20 May 2009, 17:15
Location: GB

PHP not working

#26 Post by SVanguardPH2 »

just installed Puppy 4.20:

from puppy-4.2retro-k2.6.21.7-seamonkey

downloaded and installed the .pet:

LAMP-6.11-5.1.31-5.2.8.pet.gz

rebooted. all seems to be doing well. http://localhost/ gives me the Hiawatha index.html page. So the /etc/init.d/rc.httpd and rc.mysql scipts are doing their job okay.

and sadly that's where the fun stops :( I changed all the relevant config files to replace 127.0.01 or localhost to be 192.168.0.76 (as that is the fixed IP of the machine) any .PHP files that are accessed are just returned as plain text rather than being processed by /usr/local/bin/php-cgi


The logs don't show any errors.

Is there any way to "see" that the php-cgi is actually working?

any ideas appreciated.

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

Hiawatha config

#27 Post by growler »

Maybe you could post your httpd.conf
You can check if php is actually running by examining the processes you should see 3 or 4 php-cgi processes for each of the fast cgi daemons - or from the command line

Code: Select all

#ps -ef |grep php

SVanguardPH2
Posts: 8
Joined: Wed 20 May 2009, 17:15
Location: GB

httpd.conf and running processes

#28 Post by SVanguardPH2 »

The PHP processes seem to be running:

Code: Select all

root     16147 10330  3 09:09 pts/0    00:00:00 grep php
nobody   29353     1  0 May20 ?        00:00:00 /usr/local/bin/php-cgi -b 192.168.0.76:2005 -c /etc/php.ini
nobody   29370 29353  0 May20 ?        00:00:00 /usr/local/bin/php-cgi -b 192.168.0.76:2005 -c /etc/php.ini
nobody   29371 29353  0 May20 ?        00:00:00 /usr/local/bin/php-cgi -b 192.168.0.76:2005 -c /etc/php.ini
nobody   29372 29353  0 May20 ?        00:00:00 /usr/local/bin/php-cgi -b 192.168.0.76:2005 -c /etc/php.ini

and here is the content of the /etc/hiawatha/httpd.conf file:

Code: Select all

# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
#ServerId = www-data
ServerId = nobody
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log


# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
	Port = 80
	MaxRequestSize = 512
#	Interface = 127.0.0.1
#	MaxKeepAlive = 30
#	TimeForRequest = 3,20
}
#
#Binding {
#	Port = 443
#	Interface = ::1
#	MaxKeepAlive = 30
#	TimeForRequest = 3,20
#	ServerKey = hiawatha.pem
#	UseSSL = yes
#}


# BANNING SETTINGS
# Deny service to clients who misbehave.
#
#BanOnGarbage = 300
#BanOnMaxPerIP = 60
#BanOnMaxReqSize = 300
#KickOnBan = yes
#RebanDuringBan = yes
MimetypeConfig = /etc/mime.types

# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications. Use the 'php-fcgi'
# tool to start PHP as a FastCGI daemon.
#
#CGIhandler = /usr/bin/php-cgi:php
CGIhandler = /usr/bin/perl:pl
#CGIhandler = /usr/bin/python:py
#CGIextension = cgi
CGIextension = pl
#
TimeForCGI = 60
#
#FastCGIserver {
#	FastCGIid = PHP4
#	ConnectTo = 127.0.0.1:2004
#	Extension = php, php4
#}
#
FastCGIserver {
	FastCGIid = PHP5
	ConnectTo = 192.168.0.76:2005
	Extension = php
	SessionTimeout = 60
}


# URL REWRITING
# These URL rewriting rules are made for the Skeleton PHP framework,
# which can be downloaded from: http://skeleton.leisink.org/
#
#UrlRewrite {
#	RewriteID = skeleton
#	Match ^/$ Return
#	RequestURI isfile Exit
#	Match (.*)\?(.*) Rewrite $1&$2
#	Match /(.*) Rewrite /index.php?page=$1
#}


# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 192.168.0.76
WebsiteRoot = /root/httpd/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi


# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
#VirtualHost {
#	Hostname = www.my-domain.com
#	WebsiteRoot = /var/www/my-domain/public
#	StartFile = index.php
#	AccessLogfile = /var/www/my-domain/log/access.log
#	ErrorLogfile = /var/www/my-domain/log/error.log
#	ExecuteCGI = yes
#	FastCGI = PHP4
#}

# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
Directory {
	Path = /root/http/hiawatha/phpMyAdmin
	StartFile = index.php
}

VirtualHost {
	Hostname = 192.168.0.76
	WebsiteRoot = /root/httpd/hiawatha
	StartFile = index.html
	AccessLogfile = /var/log/hiawatha/access.log
	ErrorLogfile = /var/log/hiawatha/error.log
	ExecuteCGI = yes
	FastCGI = PHP5
}

and if I enter the following URL: http://192.168.0.76/phpMyAdmin/index.php

it doesn't seem to process, just outputs the content:

Code: Select all

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * forms frameset
 *
 * @version $Id: index.php 12022 2008-11-28 14:35:17Z nijel $
 * @uses    $GLOBALS['strNoFrames']
 * @uses    $GLOBALS['cfg']['QueryHistoryDB']
 * @uses    $GLOBALS['cfg']['Server']['user']
 * @uses    $GLOBALS['cfg']['DefaultTabServer']     as src for the mainframe
 * @uses    $GLOBALS['cfg']['DefaultTabDatabase']   as src for the mainframe
 * @uses    $GLOBALS['cfg']['NaviWidth']            for navi frame width
 * @uses    $GLOBALS['collation_connection']    from $_REQUEST (grab_globals.lib.php)
 *                                              or common.inc.php
 * @uses    $GLOBALS['available_languages'] from common.inc.php (select_lang.lib.php)
 * @uses    $GLOBALS['db']
 * @uses    $GLOBALS['charset']
 * @uses    $GLOBALS['lang']
 * @uses    $GLOBALS['text_dir']
 * @uses    $_ENV['HTTP_HOST']
 * @uses    PMA_getRelationsParam()
 * @uses    PMA_purgeHistory()
 * @uses    PMA_generate_common_url()
 * @uses    PMA_VERSION
 * @uses    session_write_close()
 * @uses    time()
 * @uses    PMA_getenv()
 * @uses    header()                to send charset
 */
..etc...etc....


Is there a missing mimetype setting somewhere? or am I barking up the wrong tree?

SVanguardPH2
Posts: 8
Joined: Wed 20 May 2009, 17:15
Location: GB

interestingly....

#29 Post by SVanguardPH2 »

After posting the httpd.conf file contents and viewing them in a bit more detail , it did appear that the extra virtualhost setting was being ignored (as I now see in an earlier posting by Growler).

To test this I copied the following lines:

Code: Select all

   ExecuteCGI = yes 
   FastCGI = PHP5 
and placed them in the DEFAULT WEBSITE settings:

Code: Select all

# DEFAULT WEBSITE 
# It is wise to use your IP address as the hostname of the default website 
# and give it a blank webpage. By doing so, automated webscanners won't find 
# your possible vulnerable website. 
# 
Hostname = 192.168.0.76 
WebsiteRoot = /root/httpd/hiawatha 
StartFile = index.html 
AccessLogfile = /var/log/hiawatha/access.log 
ErrorLogfile = /var/log/hiawatha/error.log 
ExecuteCGI = yes 
FastCGI = PHP5 
rebooted. And now PHP is working.

So, my understanding is that the DEFAULT WEBSITE cannot contain the IP address that is the same for a VirtualHost setting (which does kind of make sense now and reflects an earlier posting - amazing how that earlier posting didn't mean anything until after hitting the problem, overcoming it and then re-reading the post!).


Okay - excellent news :D I can finish off migrating a PHP-Fusion + Mysql website that was running on Windoze onto Puppy Linux.

(If I had a tail, I'd be wagging it)


phpinfo() returns the following now:

Code: Select all

PHP Version 5.2.8

System	Linux puppypc 2.6.21.7 #1 Sat Aug 30 18:33:20 GMT-8 2008 i586
Build Date	Feb 22 2009 11:39:48
Configure Command	 ./configure --prefix=/usr/local --without-pear --enable-fastcgi --enable-ftp --with-bz2 --with-gd --with-gettext --with-mysql=/usr/local --with-mysqli --enable-wddx --enable-mbstring --with-mcrypt=/usr/lib
Server API	CGI/FastCGI
Virtual Directory Support	disabled
Configuration File (php.ini) Path	/usr/local/lib
Loaded Configuration File	/etc/php.ini
Scan this dir for additional .ini files	(none)
additional .ini files parsed	(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.bzip2
Registered Stream Socket Transports	tcp, udp, unix, udg
Registered Stream Filters	string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, bzip2.*
etc...

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

Hiawatha config

#30 Post by growler »

Yes I have had some interest with configuration and your question should have jogged my memory on having had the same issue - must have had too many sleeps since then...


A tool that is bundled with hiawatha for checking configuration files is the wigwam utility - this checks for "non-fatal" configuration issues - if you put a hostname in as the main web-site and also for a virtual server section you get

Code: Select all

# wigwam -c /etc/hiawatha/          
Using /etc/hiawatha/
Reading httpd.conf
Duplicate hostname '192.168.0.5' found on line 121 in '/etc/hiawatha//httpd.conf'.
Duplicate extension (pl) found in CGIhandler /usr/bin/perl.
You indigenous north Americans should feel right at home with Hiawatha config.

The developer added this check for duplicate hostnames after I had spent some time debugging the same issue and asked him and posted my config at the www.hiawatha-websever.org forum - I think it was added for hiawatha 6.11 which is in my latest pet

SVanguardPH2
Posts: 8
Joined: Wed 20 May 2009, 17:15
Location: GB

php query

#31 Post by SVanguardPH2 »

on a slightly different note...

I see from the original URL : LAMP vs PLHMP

that PHP was compiled with the following:

Code: Select all

./configure --prefix=/usr/local --without-pear --enable-fastcgi
--enable-ftp --with-bz2 --with-gd --with-gettext
--with-mysql=/usr/local --with-mysqli --enable-wddx --enable-mbstring
--with-mcrypt=/usr/lib
the CMS system (PHP-Fusion 6) I've ported to now run on this configuration makes a call to imagecreatefromjpeg() to upload images, create thumbnails of them etc.. I thought that function was part of the gd library?

Apart from that minor blip, I'm happy to say that porting from Windows 2003 Server running Apache, MySql and PHP to Puppy Linux 4.2 running on an eBox 2300 with 200Mhz and 128Mb RAM has been rather entertaining and enjoyable!... now if I could just get that last bit working.... :lol:

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

magecreatefromjpeg()

#32 Post by growler »

That's an odd one - I see there is an option in /etc/php.ini

Code: Select all

[gd]
; Tell the jpeg decode to libjpeg warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
;gd.jpeg_ignore_warning = 0
Not sure what difference it will make if you set it to 1.

The gd library definitely works since I am using the phplot scripts for graphing which requires gd. Would be interested to learn the exact message reported and see the code producing it.

SVanguardPH2
Posts: 8
Joined: Wed 20 May 2009, 17:15
Location: GB

#33 Post by SVanguardPH2 »

Apologies for the delay, have been offline for a week (a rare event to accomplish these days!)

Well, after trying numerous things, I've conceded that porting PHP-Fusion 6 from a Windows 2k3 Server to Puppy Linux is a no-go. I've found far too many errors (not just the image creation one). I thought it was the usual permissions issues, but alas it seems like the code that was written just doesn't want to run on Puppy.

So..... time to ditch PHP Fusion and install a different light weight CMS that WILL run on Puppy Linux (ditch the CMS rather than the OS - I think I'm a convert now!)

Am going to checkout ZenPhoto with the ZenPage plugin and see how that works out (most of the website that will run from PuppyLinux will just be photos anyhow).

If anyone has any other suggestions for a simple CMS that runs on Puppy, let me know!

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

pplog

#34 Post by raffy »

Barry has originally released Puppy 4 with Hiawatha server and PPLOG. See PPLOG at work in http://puppylinux.com/blog

Forum member prit1 hs ported PPLOG to PHP with PritLog:
http://hardkap.net/pritlog/
Puppy user since Oct 2004. Want FreeOffice? [url=http://puppylinux.info/topic/freeoffice-2012-sfs]Get the sfs (English only)[/url].

User avatar
growler
Posts: 209
Joined: Mon 24 Mar 2008, 04:42
Location: Kapiti - New Zealand

Simple CMS with puppy

#35 Post by growler »

I've been using Joomla with no issues.

I have had silverstripe going and I understand magento can also be used but there is a trick in the configuration of hiawatha since you have to do some URL re-writing hiawatha has a URL toolkit to enable URL re-writing but I must say the syntax is beyond me the author of hiawatha has been helpful getting these going

see http://www.hiawatha-webserver.org/forum/topic/127

of course these all need PHP and mysql - using my pet

Post Reply