Well using two packages (which can be stripped to only one) I managed to create a bash script that will take the php script file and transform it to html (which is saved temporarily in the current directory), thus being able to run it easily in firefox. Here we go!
Firstly, install the packages, in Ubuntu:
sudo apt-get install php5-cli debianutils
From these packages we'll use the php command (php5-cli) and the tempfile command (debianutils)
Next we create the bash "phpview" convert script. Fire up the terminal (Applications > Accessories > Terminal):
Inside place the following code:
file=`tempfile -d . -s .html`
echo "Creating file: $file"
php5 $1 > $file
echo "Press any key to delete the temporary html file or ctrl-c to stop this script and keep it"
echo "Removing $file"
Save and close the gedit text editor and make phpview.sh executable:
chmod +x $HOME/phpview.sh
That's about it, we can create a test php/html file:
Place in the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<body><?php echo "Hello world!"; ?></body>
Save and close.
Now let's test it!!