How to Run scheduled tasks in PHP by a web server [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have uploaded a php base project to domain , which send messages from webpage to mobiles.For this purpose user open webpage every midnight and the code work well.
My question is can i update my script to send message automatically at midnight without a user open that page in browser?
i searched and find a result of cron-job. if it is right that with cron-job a domain send messages without any laptop or computer browser than please give me scripts of how to use cron-job in php. because i am totally new to cron-job.
otherwise please suggest me a way of doing such job. thanks

I would use the crontab feature inside a linux server
crontab -e
and then enter it like this:
wget -O /dev/null "{URL_GOES_HERE}" > /dev/null 2>&1
Of course change the {URL_GOES_HERE} to the real url. This will run every minute, if you want to run per 5 min or equal then you can checkout the link on wikipedia.
https://en.wikipedia.org/wiki/Cron

Related

Need to run cron job for my php file on hosting server [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have php file on my linux hosting server and i want to execute it 2 times a day. Below is my link of my php file. Kindly tell me command line code for my php file.
http://viewpackages.com/prices/generator/footer.php
See attached image which is my hosting cron job form. Tell me what i have to write in command line text field
click here to see image of my hosting cron job form
Try pasting this on the command option:
wget -O /dev/null http://viewpackages.com/prices/generator/footer.php
Test it and tell me if there's anything wrong

Mac OS app which runs php script [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a php script which runs using terminal and then it keeps running. It dumps data from a remote server into local directory by creating .txt files. Now I want to create a Mac app which once open will run this script.
I dont want to use terminal I just want to create an app which when starts runs the script and as long as the app is running the script would be running.
My question is is there any way we can run a php script in a Mac application.
Create a YOURNAME.command file, put what you want to execute inside and make it executable with chmod +x YOURNAME.command
The file when you double click will execute what you put inside.

How to enable php run python script on GPU? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
In my php website, I call a python script using theano and running on GPU.
However, when calling this python script from php, it seems apache doesn't have any permissions on GPU so the program falls back on CPU, which is far less efficient compared to GPU.
How can I grant apache rights to run programs on GPU?
I would split that up, save the requirement as event in some storage (redis for example or even rabbitmq) and listen to that with some daemonized script (cron would be a bad joice since its hard to make it run more often than every minute). The script will update the storage entry with the results and you can access it again in your http stack. You can implement the functionallity via ajax or utilize a usleep command in php to wait for the results. If using a while loop, dont forget to break it after 1 second or something, so the request is not running too long.
Your problem might be the configured user, that executes the php binary - it maybe not permitted to access those binaries on your system. Typically its the www-data user. By adding the www-data user to the necessary group, you might be able to solve it without splitting all up. Have a look at the binary's ownerships and permissions to figure that out.

Multiple PHP Requisitions per minute [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is there a way in the server-side to execute once an operation instead of execute it every time when I sent a PHP request?
For example, I have an website that makes a lot of requisitions, but its independent from user or anything else, it just depends on the application running in the server with wich I'm willing to manage with my website.
So I want a way to just get the data that I need, processed by a script in the server not by every PHP request, i.e. The server will execute the only once and then I can grab the data with PHP.
As lonut suggested use cronjob (linux) or task manager (windows) to run you PHP task at specific intervals.
You can run standalone php script from the command line by using php path/to/your/script.php

Cron job to run php script [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I've got a simple script that sends email if you refresh the page. I need it to run every week. I setup a command in CPanel to run that script
php /home/site/public_html/test/sendmail.php
But it does not work. Hosting support says I setup cron in CP correctly.
I wander if I need any intermediate script to run sendmail.php. Thank you for your help in advance.
Most likely you'll need to expand your cron call to /usr/bin/php /home/site/public_html/test/sendmail.php, because the system can't find the path to the php executable.
You can also add a PHP shebang to the script and run it like a normal shell script without php -f:
#!/usr/bin/php
<?php
//your code
?>
To get the PHP path, use this code: <?php echo PHP_BINDIR, PHP_EOL; ?>

Categories