PDA

View Full Version : Shell Help: Running a PHP Script Inside Home Directory



Gias Kay
December 13th, 2009, 08:23 PM
Hi all,

As far as I know, below is one of the ways to have a shell script executing a PHP file, providing that the PHP file can be reached through the internet:


#!/bin/sh
wget -t 1 -q -O - "http://localhost/scripts/example.php"

My question is, whether I can put the PHP file inside my home directory (keeping it away from the net for security reasons) but still being able to execute it? And if so, what is the correct Shell script to do the task? Thanks for your help!

Physical Hook
December 13th, 2009, 08:41 PM
Install php5-cli.

Gias Kay
December 13th, 2009, 09:28 PM
Nice, I got it, thanks :D

Hellkeepa
December 14th, 2009, 04:04 AM
HELLo!

Also, add the correct shebang line to the top of the PHP-script, add execute permissions to it, and you can use it just like any other shell script. ;-)

Happy codin'!

Barriehie
December 14th, 2009, 03:19 PM
On a side note what I've ended up doing is creating a www folder in my home dir and then anything that I want net available gets a sym link in /var/www. It's a spin off of my backup routine... :)

Barrie