Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 30 Jul 2014, 07:35
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
How to add PHP to Hiawatha server?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 9 [123 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 7, 8, 9 Next
Author Message
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Fri 21 Nov 2008, 16:34    Post subject: PHP works localhost but not via real IP  

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:

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:

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
Back to top
View user's profile Send private message 
gammagone

Joined: 19 Nov 2008
Posts: 21

PostPosted: Fri 21 Nov 2008, 23:13    Post subject:  

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
Back to top
View user's profile Send private message 
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Sat 22 Nov 2008, 01:01    Post subject: Hiawatha On an Off Script  

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.
Back to top
View user's profile Send private message 
awatar100

Joined: 16 Mar 2009
Posts: 3

PostPosted: Mon 16 Mar 2009, 14:39    Post subject:  

I dont know why but in my puppy i have to config firewall also so vhost work
Back to top
View user's profile Send private message 
tcubed

Joined: 23 Mar 2009
Posts: 2

PostPosted: Mon 23 Mar 2009, 15:00    Post subject: clean the pids when stopping Hiawatha
Subject description: remove php-fcgi-pid
 

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:
rm -f /var/run/php-fcgi.pid

to the stop section.

HTH
Back to top
View user's profile Send private message 
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Sun 29 Mar 2009, 02:17    Post subject: new LAMP pet  

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 Very Happy) and the LAMP platform/acronym is widely understood.

see

http://www.puppylinux.org/wiki/software-applications/internet1/lamp-vs-plhmp-php-and-mysql-with-hiawatha

(link updated for rejig of the wiki)

@tcubed:

Quote:
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, 00:54; edited 1 time in total
Back to top
View user's profile Send private message 
tcubed

Joined: 23 Mar 2009
Posts: 2

PostPosted: Tue 31 Mar 2009, 00:02    Post subject: php-fcgi start/stop logic
Subject description: orphan pid
 

Quote:
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.
Back to top
View user's profile Send private message 
daniel.walmsley

Joined: 16 Apr 2009
Posts: 1
Location: Palmy North

PostPosted: Thu 16 Apr 2009, 22:40    Post subject: php not starting  

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.
Back to top
View user's profile Send private message 
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Fri 17 Apr 2009, 00:14    Post subject: More info please  

Please could you list:

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

Thanks
Back to top
View user's profile Send private message 
Gill_Baits

Joined: 25 Aug 2007
Posts: 23

PostPosted: Tue 12 May 2009, 20:38    Post subject: Re: php not starting  

!
Last edited by Gill_Baits on Sat 05 Dec 2009, 03:53; edited 1 time in total
Back to top
View user's profile Send private message 
SVanguardPH2

Joined: 20 May 2009
Posts: 8
Location: GB

PostPosted: Wed 20 May 2009, 13:48    Post subject: PHP not working  

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 Sad 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.
Back to top
View user's profile Send private message 
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Wed 20 May 2009, 15:53    Post subject: Hiawatha config  

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:

#ps -ef |grep php
Back to top
View user's profile Send private message 
SVanguardPH2

Joined: 20 May 2009
Posts: 8
Location: GB

PostPosted: Thu 21 May 2009, 04:13    Post subject: httpd.conf and running processes  

The PHP processes seem to be running:
Code:

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:

# 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:

<?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?
Code:
Back to top
View user's profile Send private message 
SVanguardPH2

Joined: 20 May 2009
Posts: 8
Location: GB

PostPosted: Thu 21 May 2009, 05:19    Post subject: interestingly....  

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:

   ExecuteCGI = yes
   FastCGI = PHP5

and placed them in the DEFAULT WEBSITE settings:
Code:

# 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 Very Happy 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:

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...
Back to top
View user's profile Send private message 
growler


Joined: 24 Mar 2008
Posts: 209
Location: Kapiti - New Zealand

PostPosted: Thu 21 May 2009, 06:02    Post subject: Hiawatha config  

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:

# 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
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 9 [123 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 7, 8, 9 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1184s ][ Queries: 13 (0.0078s) ][ GZIP on ]