Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-20-2005, 07:15 PM   #1
Mr Pheer
Retired
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Posts: 21,259
php help please <-click

how do i run a php file from the command line?

I'm trying to add it to cron, but just pasting the path to the file is not working

help please
__________________
2 lifeguards for Jessica
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:16 PM   #2
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
do it through wget..

so

wget "www.site.com/script.php?var=bla"
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:17 PM   #3
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
/usr/bin/php /path/to/the/phpfile.php
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:17 PM   #4
vending_machine
Confirmed User
 
Join Date: Jun 2002
Location: Seattle
Posts: 1,062
If you have the php binary installed on your system (try 'which php' ) to see if you have it installed, you can do:

Code:
/path/to/your/php /your/file.php
vending_machine is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:19 PM   #5
Mr Pheer
Retired
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Posts: 21,259
thanks guys
__________________
2 lifeguards for Jessica
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:20 PM   #6
polle54
Confirmed User
 
Join Date: Jul 2004
Location: The Beach
Posts: 4,626
my cronjobs are setup like this, have no idea if you can use this as an example.

00,15,30,45 * * * * cd /www/virtual/something/www.lalalalala.com/htdocs/jobs; /usr/local/bin/php toplist.php3 >/dev/null
__________________
ICQ# 143561781
polle54 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:23 PM   #7
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Normally in the php script itself, I just set as the first line:

#!/usr/local/bin/php -q (the -q is for quiet mode, so it doesnt echo the php version and all that)

Of course that should be set to wherever php binary is on your machine.

Then you just need to have the path of that script in your crontab, nothing additional.
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:25 PM   #8
Mr Pheer
Retired
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Posts: 21,259
ok, dont have wget on the server and cant do it thru cron with php cause it needs to run on the domain itself because of permissions

any ideas?
__________________
2 lifeguards for Jessica
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:29 PM   #9
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Quote:
Originally Posted by MrPheer
ok, dont have wget on the server and cant do it thru cron with php cause it needs to run on the domain itself because of permissions

any ideas?
My post above can't work for you ?

If you don't have permissions to execute the php binary on the system, then accessing it via web seems to be the only way. Two options there are via curl, if its installed, or lynx (again if its installed).
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:37 PM   #10
Mr Pheer
Retired
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Posts: 21,259
Quote:
Originally Posted by Varius
My post above can't work for you ?

If you don't have permissions to execute the php binary on the system, then accessing it via web seems to be the only way. Two options there are via curl, if its installed, or lynx (again if its installed).
i guess i'm fucked cause neither is installed. its not a file permission thing, the domain is encoded in the script, and it has to be run on the domain itself, filepath isnt working
__________________
2 lifeguards for Jessica
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:44 PM   #11
ArcherJanvier
Confirmed User
 
ArcherJanvier's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Las Vegas, NV
Posts: 194
Sorry, wrong thread

Last edited by ArcherJanvier; 10-20-2005 at 07:47 PM..
ArcherJanvier is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 07:54 PM   #12
Varius
Confirmed User
 
Industry Role:
Join Date: Jun 2004
Location: New York, NY
Posts: 6,890
Quote:
Originally Posted by MrPheer
i guess i'm fucked cause neither is installed. its not a file permission thing, the domain is encoded in the script, and it has to be run on the domain itself, filepath isnt working
Ok, I understand now, that (I assume) for security, the script was designed to only run on that specific domain....

Another option you could do is write a php script that you will call from the cron, looking something like this:

PHP Code:
#!/usr/local/bin/php -q

<?PHP
set_time_limit
(0);

fopen('http://www.domain.com/whatever.php','r');
exit;

?>
This assumes of course that the servers has allow_url_fopen enabled, which it normally is by default I believe (so if you get a warning and the fopen fails could be because someone has disabled that).
__________________
Skype variuscr - Email varius AT gmail
Varius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 08:10 PM   #13
Mr Pheer
Retired
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Posts: 21,259
Quote:
Originally Posted by Varius
Ok, I understand now, that (I assume) for security, the script was designed to only run on that specific domain....

Another option you could do is write a php script that you will call from the cron, looking something like this:

PHP Code:
#!/usr/local/bin/php -q

<?PHP
set_time_limit
(0);

fopen('http://www.domain.com/whatever.php','r');
exit;

?>
This assumes of course that the servers has allow_url_fopen enabled, which it normally is by default I believe (so if you get a warning and the fopen fails could be because someone has disabled that).

That worked!

thanks man... you rock!!
__________________
2 lifeguards for Jessica
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2005, 08:13 PM   #14
OzMan
Confirmed User
 
OzMan's Avatar
 
Join Date: Sep 2003
Location: Los Begas
Posts: 9,162
Is this related to this by chance? One of the options I suggested should work assuming file permissions are set to 777 or whatever they need to be.

edit: nm you figured it out
OzMan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.