![]() |
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 :helpme :helpme :helpme |
do it through wget..
so wget "www.site.com/script.php?var=bla" |
/usr/bin/php /path/to/the/phpfile.php
|
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 |
thanks guys :)
|
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 |
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. |
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? |
Quote:
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). |
Quote:
|
Sorry, wrong thread
|
Quote:
Another option you could do is write a php script that you will call from the cron, looking something like this: PHP Code:
|
Quote:
That worked! thanks man... you rock!! :winkwink: |
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 :upsidedow |
All times are GMT -7. The time now is 08:35 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123