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 27 Aug 2014, 05:14
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to integrate php with hiawatha webserver?[solved]
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
selvam

Joined: 03 Dec 2013
Posts: 138

PostPosted: Fri 03 Jan 2014, 08:49    Post_subject:  How to integrate php with hiawatha webserver?[solved]  

Please help me integrate php with hiawatha webserver
my hiawatha.conf,php-fcgi.conf ,error.log,i.php is below
my hiawatha.conf is
*********************************************************************
# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
ServerId = webuser
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log
ErrorLogfile = /var/log/hiawatha/error.log
PIDFile = /var/run/hiawatha.pid
ExploitLogfile = /var/log/hiawatha/exploit.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/sbin/php-fcgi:php
#CGIhandler = /usr/bin/perl:pl
#CGIhandler = /usr/bin/python:py
#CGIextension = cgi
#CGIextension = pl
CGIextension = php
TimeForCGI = 60
#
#FastCGIserver {
# FastCGIid = PHP4
# ConnectTo = 127.0.0.1:2004
# Extension = php, php4
#}
#
FastCGIserver {
FastCGIid = PHP-fpm
ConnectTo = 127.0.0.1:9000
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 = 127.0.0.1
WebsiteRoot = /root/Web-Server
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
ExecuteCGI = yes


# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#

VirtualHost {
Hostname = localhost
WebsiteRoot = /root/Web-Server
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
UseFastCGI = PHP5
UseXSLT = yes
}
# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
**********************************************************
my php-fcgi.conf is
************************************************************
# PHP FastCGI configuration

# PidFile = <path to PID-file>
#
#PidFile = /var/run/php-fcgi.pid

# Forks = <number of forks per server>
#
#Forks = 3

# Setenv <key> = <value>
#

# Server = <php-cgi executable>;<binding>;<UID>[:<GIDs>][;<PHP configuration file>]
#
#Server = /usr/bin/php5-cgi ; 127.0.0.1:2005 ; www-data
#Server = /usr/bin/php5-cgi ; 127.0.0.1:2005 ; 1000:100,101
Server = /usr/bin/php5-cgi ; 127.0.0.1:2005 ; www-data ; /etc/php5/cgi/php.ini
#Server = /usr/chroot|usr/bin/php5-cgi ; 127.0.0.1:2005 ; www-data
****************************************************
my error.log is
******************************************************
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|/root/Web-Server/i.php: line 1: ?php: No such file or directory
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|/root/Web-Server/i.php: line 3: //: is a directory
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|/root/Web-Server/i.php: line 6: syntax error near unexpected token `newline'|/root/Web-Server/i.php: line 6: `?>'
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|CGI only printed a HTTP header, no content
***********************************************************
my i.php is
******************
<?php

// Show all information, defaults to INFO_ALL
echo "selvam";

?>
**********************
Please help me
i have some wrong cgi settings

Edited_time_total
Back to top
View user's profile Send_private_message 
npierce

Joined: 28 Dec 2009
Posts: 858

PostPosted: Sat 04 Jan 2014, 13:15    Post_subject:  

selvam wrote:
my error.log is
******************************************************
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|/root/Web-Server/i.php: line 1: ?php: No such file or directory
192.168.1.5|Fri 03 Jan 2014 18:25:35 +0800|/root/Web-Server/i.php|/root/Web-Server/i.php: line 3: //: is a directory
. . .

Hiawatha thinks that your .php file is an executable script. Since the location of the PHP interpreter is not given in the first line of the file like, for example, this:
Code:
#!/usr/local/bin/php-cgi

the script is assumed to be a shell script. Since it is actually a PHP script, it fails miserably.

You could add such a line to the top of your .php file -- changing the above example to use the actual location of your PHP interpreter.

But most people just define a CGI handler for .php files, so that Hiawatha knows to use the PHP handler for .php files. Then there is no need to give the location of the interpreter in the first line of the .php file.

You have already defined a CGI handler for .php files, with this line in your hiawatha.conf file:
Code:
CGIhandler = /usr/sbin/php-fcgi:php

(Although, I'm not sure if php-fcgi is a valid PHP handler or not. Maybe not.)

But the main thing that is confusing Hiawatha is this line:
Code:
CGIextension = php

That is what causes Hiawatha to think that a .php file is an executable script. You should remove or comment-out that line.

There may well be other errors in your configuration, but try that first.
Back to top
View user's profile Send_private_message 
selvam

Joined: 03 Dec 2013
Posts: 138

PostPosted: Mon 06 Jan 2014, 00:42    Post_subject:  

i get Unknown option. Use '-h' for help.
which is same as i type php-fcgi on the terminal
i have

# 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/sbin/php-fcgi:php
#CGIhandler = /usr/bin/perl:pl
#CGIhandler = /usr/bin/python:py
#CGIextension = cgi
#CGIextension = pl
CGIextension = php
#TimeForCGI = 60


FastCGIserver {
FastCGIid = PHP-fpm
ConnectTo = 127.0.0.1:9000
Extension = php
SessionTimeout = 60
}
the hiawatha howto tells the fastcgiserver extension overrides the cgihandler. but that does not happen. iam using hiawatha 8
i want php-fpm to handle the php calls
i checked by typing php-fpm at terminal it says it is already listening on 127.0.01:9000
but still i get " Unknown option. Use '-h' for help. " emitted by php-fcgi
Please help
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Mon 06 Jan 2014, 11:50    Post_subject:  

selvam wrote:
..i checked by typing php-fpm at terminal it says it is already listening on 127.0.01:9000

but
selvam wrote:
Server = /usr/bin/php5-cgi ; 127.0.0.1:2005 ; www-data ; /etc/php5/cgi/php.ini
is not port 9000 Rolling Eyes
Back to top
View user's profile Send_private_message 
npierce

Joined: 28 Dec 2009
Posts: 858

PostPosted: Mon 06 Jan 2014, 12:01    Post_subject:  

selvam wrote:
the hiawatha howto tells the fastcgiserver extension overrides the cgihandler

Yes, that is true. If you choose to use FastCGI, there is no need to define a CGIhandler for PHP files since, in that case, UseFastCGI and FastCGIserver define how PHP files are to be handled.

I don't know if UseFastCGI and FastCGIserver overrides CGIextension.


selvam wrote:
i want php-fpm to handle the php calls

Your FastCGIserver section defines FastCGIid as "PHP-fpm":
selvam wrote:
FastCGIserver {
FastCGIid = PHP-fpm
ConnectTo = 127.0.0.1:9000
Extension = php
SessionTimeout = 60
}

But your VirtualHost section defines UseFastCGI as "PHP5":
selvam wrote:
VirtualHost {
Hostname = localhost
WebsiteRoot = /root/Web-Server
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
UseFastCGI = PHP5
UseXSLT = yes
}

So localhost will try to use the server identified as "PHP5" and fail, since you have no server defined with that identity.

And the definition of your default website has no UseFastCGI line:
selvam wrote:
Hostname = 127.0.0.1
WebsiteRoot = /root/Web-Server
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
ExecuteCGI = yes

So 127.0.0.1 won't use FastCGI.


I've just noticed that you have marked the post subject "[solved]". For the benefit of others, please let us know what you had to do to solve this.
Back to top
View user's profile Send_private_message 
selvam

Joined: 03 Dec 2013
Posts: 138

PostPosted: Mon 06 Jan 2014, 23:51    Post_subject:  

i got tired of hiawatha and installed apache instead and solved the problem
thanks for all the help
Back to top
View user's profile Send_private_message 
L18L

Joined: 19 Jun 2010
Posts: 2505
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Thu 09 Jan 2014, 04:32    Post_subject:  

I am tired, too. Confused
Back to top
View user's profile Send_private_message 
selvam

Joined: 03 Dec 2013
Posts: 138

PostPosted: Thu 09 Jan 2014, 07:56    Post_subject:  

try trekking or mountaineering
it refreshes you
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0832s ][ Queries: 12 (0.0110s) ][ GZIP on ]