DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 18th June 2009
amscotti's Avatar
amscotti amscotti is offline
Real Name: Anthony Scotti
Port Guard
 
Join Date: Nov 2008
Posts: 13
Thanked 0 Times in 0 Posts
Default lighttpd + PHP on OpenBSD 4.5

Hello,

I'm trying to setup lighttpd and PHP on OpenBSD 4.5. It seem that lighttpd is working fine showing the default "It Worked!" page but trying to view any PHP pages give me a "No input file specified." page.

I mostly been using the steps from this website but I installed lighttpd-1.4.21 (not -mysql)

I havn't found anything that helps on Google (Maybe I'm looking for the wrong thing) and there isn't alot of posting about lighttpd on the forums. If someone could point me in the right direction that be great!

Here some info, let me know if anything else is needed to help.
Code:
$ /var/www/usr/local/bin/php-fastcgi -v
PHP 5.2.8 with Suhosin-Patch 0.9.6.3 (cgi-fcgi) (built: Mar  1 2009 15:20:31)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH
Code:
# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $

############ Options you really have to take care of ####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
                                "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "htdocs"

#### accesslog module
accesslog.filename          = "logs/lighttpd.access.log"

## where to send error-messages to
server.errorlog             = "logs/lighttpd.error.log"

# files to check for if .../ is requested
index-file.names            = ( "index.php", "index.html", "index.htm", "default.htm" )

server.event-handler = "kqueue"
server.network-backend = "writev"

server.use-ipv6 = "enable"

$SERVER["socket"] == "0.0.0.0:80" { }

# mimetype mapping
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jar"          =>      "application/x-java-archive",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar",
  # default mime type
  ""              =>      "application/octet-stream",
 )

# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr        = "enable"

## send a different Server: header
## be nice and keep it at lighttpd
# server.tag                 = "lighttpd"

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
#      of the document-root
url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

######### Options that are good to be but not neccesary to be changed #######

## error-handler for status 404
#server.error-handler-404   = "/error-handler.html"
#server.error-handler-404   = "/error-handler.php"

## to help the rc.scripts
server.pid-file            = "/var/run/lighttpd.pid"

###### virtual hosts
##
##  If you want name-based virtual hosting add the next three settings and load
##  mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root   = "/srv/www/vhosts/"
#simple-vhost.default-host  = "www.example.org"
#simple-vhost.document-root = "/htdocs/"


##
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix    = "/usr/share/lighttpd/errors/status-"
#server.errorfile-prefix    = "/srv/www/errors/status-"

## virtual directory listings
#dir-listing.activate       = "enable"
## select encoding for directory listings
#dir-listing.encoding        = "utf-8"

## enable debugging
#debug.log-request-header   = "enable"
#debug.log-response-header  = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found   = "enable"

# chroot() to directory
server.chroot              = "/var/www/"

server.username            = "_lighttpd"
server.groupname           = "_lighttpd"

#### compress module
#compress.cache-dir         = "/var/cache/lighttpd/compress/"
#compress.filetype          = ("text/plain", "text/html")

#### proxy module
## read proxy.txt for more info
#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "192.168.0.101",
#                                   "port" => 80
#                                 )
#                               )
#                             )

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php-fastcgi.socket",
                                   "bin-path" => "/usr/local/bin/php-fastcgi"
                                 )
                               )
                            )

#### CGI module
#cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
#                               ".cgi" => "/usr/bin/perl" )
#

#### SSL engine
#ssl.engine                 = "enable"
#ssl.pemfile                = "/etc/ssl/private/lighttpd.pem"

#### status module
#status.status-url          = "/server-status"
#status.config-url          = "/server-config"

#### auth module
## read authentication.txt for more info
#auth.backend               = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"

#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
#auth.backend.ldap.filter   = "(uid=$)"

#auth.require               = ( "/server-status" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "user=jan"
#                               ),
#                               "/server-config" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "download archiv",
#                                 "require" => "valid-user"
#                               )
#                             )

#### url handling modules (rewrite, redirect, access)
#url.rewrite                = ( "^/$"             => "/server-status" )
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
#  url.redirect            = ( "^/(.*)" => "http://%1/$1" )
#}

#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern        = "/srv/www/vhosts/%3/htdocs/"

#### expire module
#expire.url                 = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")

#### ssi
#ssi.extension              = ( ".shtml" )

#### rrdtool
#rrdtool.binary             = "/usr/local/bin/rrdtool"
#rrdtool.db-name            = "/var/lib/lighttpd/lighttpd.rrd"

#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )

## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = "/var/lib/lighttpd/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10

## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension               = ".cml"
# cml.memcache-hosts          = ( "127.0.0.1:11211" )

#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"

## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")

#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"

#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
Thanks for the help!
Reply With Quote
  #2   (View Single Post)  
Old 18th June 2009
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,062
Thanked 198 Times in 156 Posts
Default

Are there more details in the error log (logs/lighttpd.error.log)?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 19th June 2009
amscotti's Avatar
amscotti amscotti is offline
Real Name: Anthony Scotti
Port Guard
 
Join Date: Nov 2008
Posts: 13
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Carpetsmoker View Post
Are there more details in the error log (logs/lighttpd.error.log)?
After restarting the computer and loading up the page.
Code:
$ cat lighttpd.error.log | grep 2009-06-19
2009-06-19 07:58:39: (server.c.1466) server stopped by UID = 0 PID = 0
2009-06-19 07:59:41: (log.c.97) server started
I did find this page talking abit more about the error ("No input file specified") that I'm getting on the PHP page. Link

It seem as if PHP can't find the file or something.
Reply With Quote
  #4   (View Single Post)  
Old 21st June 2009
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,062
Thanked 198 Times in 156 Posts
Default

Your lighttpd.conf looks fine as far as I can tell, I've never run lighttpd on OpenBSD, only on FreeBSD, so there may be some specific OpenBSD thing I'm missing.

However, from http://jenseng.com/archives/000035.html
Quote:
The reason this happens is that any requests ending in .php are simply handed off to the PHP executable without verifying that such a file exists.
What file are you trying to open?
Try creating a simple PHP file in your wwwroot, for example:
Code:
<?php phpinfo(); ?>
Name it something simple almost-impossible-to-mistype like info.php
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #5   (View Single Post)  
Old 23rd June 2009
amscotti's Avatar
amscotti amscotti is offline
Real Name: Anthony Scotti
Port Guard
 
Join Date: Nov 2008
Posts: 13
Thanked 0 Times in 0 Posts
Default

Only different that I know of is lighttpd on OpenBSD is chroot'ed to the /var/www/ directory. But truthfully this is only the second time setting up lighttpd. (Other time was on OS X, and had no issues setting up PHP)

I did change the document-root to '/var/www/pages' and made the edit to the lighttpd.conf as needed.

Code:
$ pwd
/var/www/pages
$ ls -al
total 340
drwxr-xr-x   4 _lighttpd  _lighttpd    512 Jun 17 20:15 .
drwxr-xr-x  11 root       daemon       512 Jun 19 18:52 ..
-r--r--r--   1 _lighttpd  _lighttpd   2326 Feb 28 16:29 apache_pb.gif
drwxr-xr-x   2 _lighttpd  _lighttpd    512 Feb 28 16:29 bgplg
-r--r--r--   1 _lighttpd  _lighttpd  41318 Feb 28 16:29 blowfish.jpg
-r--r--r--   1 _lighttpd  _lighttpd   4090 Feb 28 16:29 bsd_small.gif
-r--r--r--   1 _lighttpd  _lighttpd   2212 Feb 28 16:29 index.html
-rwxrwxrwx   1 _lighttpd  _lighttpd     99 Jun 17 20:15 info.php
-r--r--r--   1 _lighttpd  _lighttpd   5417 Feb 28 16:29 lock.gif
-r--r--r--   1 _lighttpd  _lighttpd  46246 Feb 28 16:29 logo23.jpg
-r--r--r--   1 _lighttpd  _lighttpd  35570 Feb 28 16:29 logo24.jpg
-r--r--r--   1 _lighttpd  _lighttpd   2007 Feb 28 16:29 mod_ssl_sb.gif
-r--r--r--   1 _lighttpd  _lighttpd   3361 Feb 28 16:29 openbsd_pb.gif
-r--r--r--   1 _lighttpd  _lighttpd   3334 Feb 28 16:29 openbsdpower.gif
-r--r--r--   1 _lighttpd  _lighttpd   2063 Feb 28 16:29 openssl_ics.gif
drwxr-xr-x  11 _lighttpd  _lighttpd   1536 Dec 18  2008 phpPgAdmin
-r--r--r--   1 _lighttpd  _lighttpd   2220 Feb 28 16:29 smalltitle.gif
$ cat info.php
<html>
<head>
<title> PHP Test Script </title>
</head>
<body>
<?php
phpinfo( );
?>
</body>
</html> 
$

Code:
$ links 127.0.0.1/info.php
Return a page with "No input file specified."
Reply With Quote
  #6   (View Single Post)  
Old 24th June 2009
indienick indienick is offline
Lisp Junkie
 
Join Date: Apr 2009
Location: London, ON, Canada
Posts: 27
Thanked 0 Times in 0 Posts
Default

I would suggest you try cheating a little bit, and just using the regular CGI module (which, in your configuration file is completely commented out).

Just add a "php" => "/usr/bin/php" (or "php" => "/usr/local/bin/php" - depending on where it's located) to the hash and that may solve your problem.

I have never tried it like this before (as I really do not like/try to avoid having to use PHP), but I have done it with Common Lisp scripts, and it works, wonderfully.
Reply With Quote
  #7   (View Single Post)  
Old 24th June 2009
amscotti's Avatar
amscotti amscotti is offline
Real Name: Anthony Scotti
Port Guard
 
Join Date: Nov 2008
Posts: 13
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by indienick View Post
I would suggest you try cheating a little bit, and just using the regular CGI module (which, in your configuration file is completely commented out).

Just add a "php" => "/usr/bin/php" (or "php" => "/usr/local/bin/php" - depending on where it's located) to the hash and that may solve your problem.

I have never tried it like this before (as I really do not like/try to avoid having to use PHP), but I have done it with Common Lisp scripts, and it works, wonderfully.
I gave that a try but the output was still the same "No input file specified.".

What did work tho was removing the chroot. commented out the "server.chroot" line and pointed everything to /var/www.

So the issue is something to do with the chroot. I'll do some more testing.
Reply With Quote
Reply

Tags
lighttpd, php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems getting lighttpd working with php and fcgi pormogo FreeBSD Ports and Packages 3 6th June 2008 10:02 PM


All times are GMT. The time now is 11:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick