rejetto forum

Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: raybob on March 22, 2012, 02:56:33 AM

Title: PHP in HFS
Post by: raybob on March 22, 2012, 02:56:33 AM
Made it possible!  It's not hard at all when you have a function to control command-line PHP and capture output  :)

See the template on the right and the resulting output in Mozilla on the left.

Unfortunately you have to use $args to pass variables into command line PHP, and running it like this clearly removes the possibility of running SMF or something.

Change "C:\program files\FHFS\php-bin\php.exe" in the script below to your correct PHP path, and place it under [request] in hfs.events.

Code: [Select]
{.set|php|{:{.if|{.exists|$1.php.}|{:{.exec|"C:\program files\FHFS\php-bin\php.exe" -n -f "C:\Program Files\FHFS\$1.php" $2|out=out.}:}|{:{.exec|"C:\program files\FHFS\php-bin\php.exe" -n -r "$1"|out=out.}:}.}{.^out.}:}.} {.comment| PHP FUNCTION $1 IS SCRIPT FILENAME OR DIRECT COMMANDS, $2 IS ARGUMENTS TO PASS IF SCRIPT FILE .}

Title: Re: PHP in HFS
Post by: dccfoux on April 12, 2012, 01:45:39 AM
is this for an older version or something? Because I cannot seem to understand a thing you are talking about  :-\
I would love some help on this.
Title: Re: PHP in HFS
Post by: rejetto on April 15, 2012, 12:49:51 PM
most things published on this board (programmers corner) won't be understandable by those who are not programmers.

he is suggesting a way to interface programmatically with HFS.
it's not exactly a fast method, but it may be enough for some purposes.
Title: Re: PHP in HFS
Post by: dccfoux on April 15, 2012, 01:23:42 PM
most things published on this board (programmers corner) won't be understandable by those who are not programmers.

he is suggesting a way to interface programmatically with HFS.
it's not exactly a fast method, but it may be enough for some purposes.
thats what I thought. I wanted to host like a forum from it(backup my site).
Title: Re: PHP in HFS
Post by: rejetto on April 15, 2012, 02:16:24 PM
you cannot run a php forum with this solution
Title: Re: PHP in HFS
Post by: raybob on April 16, 2012, 02:33:34 PM
Rejetto is right.  That won't be possible until PHP is implemented directly into HFS.  This method is only for simple PHP commands or in-line scripts.  Each command takes roughly 0.07 seconds, so loading up a page with tons of php commands will make a very slow page.  What you can do with this is very limited, but it still opens up a few possibilities.  

That being said, if you were to take the time to reprogram a PHP script to use just argument variables in place of URL Variables, posted variables, and cookies, then it could theoretically be possible, but not practical.