vps HELP!!!! how do you run php scripts?

tomaso88

Registered Member
Joined
Apr 14, 2010
Messages
89
Reaction score
20
How do you get a vps to run a php script 24/7? im with hostgator
 
Your question is a bit vague, but I think you're looking for cron jobs.
 
sorry never used vps before ill check out what u said and hope for the best
 
EDIT: howdo i get in cronjobs?
 
EDIT: howdo i get in cronjobs?

That would be from your CPannel inside your hosting account. You may want to contact hostgator support and ask them to show you how to set up a cron-job. Once they show you once it's just a matter of customizing that cron-job to suit your needs.
 
im not talking about in cpanel im talking about on a private sever
 
Last edited:
i need a vps to act like its on a site 24/7 so instead of me having to stay on let say example.com it stays on example.com its self and runs the php script how do i do that
 
you need a vps to act like its on a site 24/7?....
AFAIK vps means virtual private server and it's a type of hosting plan... like shared hosting, or dedicated hosting.
I think you need to re-formulate your question better so that someone here may be able to help you out.
 
A) What kind of VPS and control panel are you running?
B) Does the script need to run without turning off? Is that what you are asking?
C) Did the script come with any instructions? If so, might be helpful to share.
 
You can either run them from the command line (via the "php" command) or on a website by simply visiting the URL (assuming your web server is set up).
 
Look up wget. It will visit your site via command line. Then set up a cron job to run it every minute.
 
or just insert the php code in an infinite loop.
Login to your vps via shell and fire on
Code:
nohup php myscript.php &
and close your shell session.
 
You could also use screen run the command and then detach the screen session using CTRL+AD I use screen all the time it is a great tool. To reattach to the session type screen -ls to list the sessions and then screen -r <sessionnametoreattach> to reattach to that session.
 
Back
Top