How to create a always running PHP background script to clean up particular rows in mySql DB?
How to create a always running PHP background script to clean up particular rows in mySql DB?
Hi guys 开发者_开发百科I want to create a PHP script that automatically keeps on running (for example after every hour) and delete some particular rows from database(for example user comments those are atleast 5 days older)for this I am already having the date column in table.
Please guide me how to do this as I am new to PHP.
For this, you can create a cron job, if you have access to the cpanel.... The cron jobs will run periodically, say for every minute, hour, day or week. Refer this
what you are looking for is information on running some php maintenance scripts as a cron job. How you do that will depend upon what type of server you are using, if you are using shared hosting or have a dedicated server. In shared hosting there will be information about this on your control panel, otherwise you need to talk to your server admin.
You can set your PHP scrip that cleans up the mySql DB to run every hour or every mins/week/months with cron
crone job basic
精彩评论