DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-07-13 00:15:21

Emacs
Member
Registered: 2007-06-24
Posts: 110

PHP in lighttpd out of Fonz' fun_plug

Hi all,

I'm trying to run my media server software Oxyl (based on PHP) now with lighttpd which came in Fonz' fun_plug.

Unfortunately I cannot overcome the following problem (probably related to total lack of knowledge about lighttpd):

The example config I got, which usually works with lighttpd has the following fast-cgi part:

  fastcgi.server = ( ".php" => ((
          "bin-path" => "/var/tmp/lighttpd/cgi-bin/php",
          "socket" => "/var/tmp/php.socket",
          "max-procs" => 1,
          )))

Since I cannot find any cgi-bin or any pgp binary I''m a bit lost.
And I have no clue what php.socket is and if I really need it.

I understand the lighttpd in Fonz' package is php capable - but what do I need to do to get lighttpd to actually execute PHP scripts?

When I access the server page right now (oxylstart.php) my browser (on PC) wants to actually download the PHP script (compared to have it executed and do something)...

I'd be glad for any pointers into the right direction!

Cheers,

Emac

Last edited by Emacs (2007-07-13 00:16:28)

Offline

 

#2 2007-07-13 00:49:49

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: PHP in lighttpd out of Fonz' fun_plug

Hmm - I found an old thread here with a cgi-php precompiled by Fonz and an accompanying lighttpd.conf.

Looked good first, but unfortunately the problem still persists. When accessing the server with a browser (Firefox) it wants to download the php files...

Any thoughts?

Cheers,

Emacs

Offline

 

#3 2007-07-13 01:10:31

MiK
Member
From: Sweden
Registered: 2006-12-17
Posts: 102

Re: PHP in lighttpd out of Fonz' fun_plug

Did you check the lighttpd.conf that fonz posted here?

http://dns323.kood.org/forum/viewtopic. … 60&p=2

Offline

 

#4 2007-07-13 02:09:55

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: PHP in lighttpd out of Fonz' fun_plug

Yep, that's the one I use with the following fast-cgi code

fastcgi.server = ( ".php" => ((
    "bin-path"  => "/mnt/HD_a2/fun_plug.d/bin/php-cgi",
    "socket"    => "/tmp/php-cgi.socket",
    "max-procs" => 2
)))

It resides in

cd /mnt/HD_a2/fun_plug.d/etc

Cheers,

Emacs

Offline

 

#5 2007-07-13 10:30:35

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: PHP in lighttpd out of Fonz' fun_plug

Are you really _using_ the file I posted or have you copied only that part? What you posted is only half the changes needed to enable php.

Offline

 

#6 2007-07-13 10:54:34

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: PHP in lighttpd out of Fonz' fun_plug

Hi Fonz,

I copied the whole file and made the changes to the document root and server port. Additionally I added an alias which is needed for Oxyl (mod_alias enabled) - and that's it.
I'm at work now, but I will post my conf later today.

the fastcgi.server directive posted above should forward every file ending with ".php" to "php-cgi" and deliver the output through lighttpd to the client - right?

What is "tmp/php-cgi.socket" ? Is it just a temporary file/pipe for inter process communication between cgi-php and lighttpd, or is it something I have to create/install manually?


>What you posted is only half the changes needed to enable php.

The other half is enabling mod_fastcgi in server.modules - right?

Cheers,

Emacs

Offline

 

#7 2007-07-13 11:12:24

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: PHP in lighttpd out of Fonz' fun_plug

Emacs wrote:

the fastcgi.server directive posted above should forward every file ending with ".php" to "php-cgi" and deliver the output through lighttpd to the client - right?

yes

Emacs wrote:

What is "tmp/php-cgi.socket" ? Is it just a temporary file/pipe for inter process communication between cgi-php and lighttpd, or is it something I have to create/install manually?

inter process communication, automatically created


Emacs wrote:

The other half is enabling mod_fastcgi in server.modules - right?

yes

have you had a look at the error log? checked that php-cgi is running?

Offline

 

#8 2007-07-13 11:23:39

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: PHP in lighttpd out of Fonz' fun_plug

The error log only shows the start-up of lightthpd - no other messages in there.
Should I see php-cgi mentioned in there as well?

Cheers,

Emacs

Last edited by Emacs (2007-07-13 11:39:03)

Offline

 

#9 2007-07-14 12:49:19

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: PHP in lighttpd out of Fonz' fun_plug

I got it going now - php scripts are executed.

Unfortunately I get an error message that the php function session_start() is undefined - which I believe may be caused if the module "php_session" is not compiled into php.
@fonz - is there a chance to get php_session into your binary?

Cheers,

Emacs

Offline

 

#10 2007-07-15 00:17:19

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: PHP in lighttpd out of Fonz' fun_plug

Emacs wrote:

@fonz - is there a chance to get php_session into your binary?

Yes. I've added quite a number of functions to my php binary, but these additions also require that I add shared libs to the funplug. I've uploaded my current testing version to http://www.inreto.de/dns323/fun-plug/testing/

You're welcome to try it, but note that it hasn't had much testing yet. It's a whole new funplug - have a look at the upgrade instructions and make sure you backup your fun_plug file and fun_plug.d directory in case it doesn't work for you. Also have a look at the Changelog.

Have fun.

Offline

 

#11 2008-03-13 19:00:25

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: PHP in lighttpd out of Fonz' fun_plug

I'm trying to get PHP working and i'm using Fonz funplug 0.4. I've been reading through the forum but i'm having a had time figuring out exactly what i need to do to get it working with lighttpd.

so far this is what i've done in lighttpd.conf.

uncomment  "mod_fastcgi", under the Modules to load section

uncomment this section and create the php-cgi folder under "/mnt/HD_a2/fun_plug.d/bin/
## php support
## uncomment the following lines and the mod_fastcgi module above
fastcgi.server = ( ".php" => ((
    "bin-path"  => "/mnt/HD_a2/fun_plug.d/bin/php-cgi",
    "socket"    => "/tmp/php-cgi.socket",
    "max-procs" => 2
)))

and i've uncommented this section
#### 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"
                                 )
                               )
                            )

but now i'm not sure what to do. where do i get the php.ini file? is this part of fonz 0.4 funplug or do i need to add these files from another download? also do i need to make any changes to the sections that i uncommented above to get it to work?

thanks

Offline

 

#12 2008-03-14 14:35:43

Nod
Member
Registered: 2008-01-14
Posts: 29

Re: PHP in lighttpd out of Fonz' fun_plug

Hi
problem I've got with lighthttp and PHP is when the disks are spinned down (and idle) ... If I send an http request that uses PHP, I have to wait while disks spins ups before response.

I'm trying to put all that is related to the web site on an usb drive ... but PHP keeps on using disks ... sad

Last edited by Nod (2008-03-14 14:36:00)

Offline

 

#13 2008-03-14 14:45:12

jrbilodeau
Member
Registered: 2007-11-26
Posts: 47

Re: PHP in lighttpd out of Fonz' fun_plug

ok i figured it out...i think, cause it's working anyway.

the first two sections that i uncommented were ok, the third section i had to recomment. then i went to fonz's site and i downloaded the PHP 5.2.4 plugin and installed it and restarted lighttpd and everything is working now.

if i'm missing something can someone let me know.

thanks

Offline

 

#14 2008-11-28 09:06:06

dv8ed
New member
Registered: 2008-11-28
Posts: 3

Re: PHP in lighttpd out of Fonz' fun_plug

I'm using Fun Plug 0.5 and used PHP 5.2.4 from Fonz Plug's website on my Dlink DNS-323 I'm getting this error when I run NZBWEBGET v1.2

Fatal error: Cannot use string offset as an array in /mnt/HD_a2/www/pages/functions.php on line 198

Any help would be appreciated.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB