Free Web Hosting with No Ads
Support Forums
Free Web Hosting Signup
Free Forum Hosting
FREE HOSTING SERVICES MEMBERS LOGIN MESSAGE BOARD FAQ
Free Web Hosting
Free Hosting
Sign Up Now
Free PHPBB
Free File Host
Free Image Host
Free Blog
Webmaster Tools
Members Login
Paid Hosting
Buy Domains
Resources
FAQ
Link Directory
Terms of Use
Contact Us
Tell a Friend



Can I run php from a command prompt?

There are couple of ways to accomplish this:

1. Code your page like normal, then call it in a cron job via lynx* (you can also wget on the URL, or links -dump). For lynx, add the following to your crontab:

0 8 * * * /usr/bin/lynx -dump http://localhost/page.php >
/path/to/logfile/or/dev/null

Now, this means your script is in your public web space, so it could be called by anyone who knew the name of the page. You can put the page in a subdirectory and add an .htaccess file that restricts access to only 127.0.0.1 or you could code the script itself to retrieve the remote IP and make sure it was 127.0.0.1.

2. With PHP installed as a CGI you could also write your page as a shell script. As the first line of your script put the line:

#!<path to php> -q

Don't forget to set the executable bits. If you are running PHP as an Apache DSO, you can build php again without the with-apxs=/blah so it builds the binary executable and install it somewhere like /usr/local/bin. That way you can use php as a scripting language much like you use sh. With this method you can just call that script without relying on the webserver.

*lynx is a text only web browser


Make Money Easy
© 2005-2010 NetFreeHost.com All Rights Reserved.