 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Justin Carmony's Blog: PHP Workers with Redis & Solo
by Chris Cornutt January 11, 2012 @ 11:50:52
In this latest post to his blog Justin Carmony shares some of his experience using Redis and Solo to asynchronously run queries and return data without the user having to wait.
Sometimes there are situations when you want to parallel process things. Other times you might have a list of tasks to accomplish, and you don't want to make the user wait after pressing a button. This is where "Workers" can come in. They are independent scripts that run along side of your application, performing tasks, or "jobs."
Solo is a very basic Perl script that ensures only one process of a type is running at once. Using this and a PHP library called predis, he shows how to set up workers and add items to your processing queue. The workers themselves run on a cron job and connect to the queue server to see what they need to do. He also throws in some "bells and whistles" - extras that can enhance your worker system: queue monitoring, version numbering and killing workers based on a hash value.
His code examples are posted on his github account and a screencast is included in the post to show the system in action.
voice your opinion now!
redis solo cron tutorial queue worker
SitePoint.com: Scheduling Tasks in WordPress a Plugin Developer's Guide
by Chris Cornutt July 21, 2010 @ 09:45:17
On SitePoint.com there's a new tutorial posted in their "PHP & MySQL tutorials" section about using a feature of WordPress that some might not know about but can be extremely handy when you need it - using WordPress tasks.
Scheduling the execution of certain functions at a time in the future is a key feature of the WordPress API, having been introduced in WordPress version 2.0. It's also a topic that's poorly understood by many developers, as it's only briefly covered in WordPress's documentation. Apart from facilitating maintenance tasks, scheduling code to be executed in the future opens up a lot of interesting possibilities for plugin developers.
He talks a bit about how the WordPress tasks work (via the wp-cron.php script) and the two types of tasks - one-off and recurring. He includes code and examples of how to set up each and some other handy features like custom timing for tasks, getting the list of scheduled tasks and a few things to watch out for when working with the feature.
voice your opinion now!
wordpress schedule task cron developer tutorial
Adam Jensen's Blog: Cron tasks in Zend Framework apps
by Chris Cornutt January 13, 2010 @ 08:45:41
In this new post to his blog Adam Jensen looks at creating cron jobs with the help of the Zend Framework without having to load up the entire MVC architecture to get there.
So, we're going to need a new application bootstrap and entry point, one that eschews the MVC routing and dispatch process in favor of something simpler. Essentially, all we'll need is to be able to run an arbitrary collection of cron "task plugins," the list of which can be configured in plain text via any of the various Zend_Config formats (e.g., the default application.ini file).
He starts with the base functionality, a task plugin interface that allows you to set up a "framework" to run the tasks in. He also creates a simple cron service that handles the execution of the tasks (this is the main executable) and includes the code for creating the bootstrap for the Zend Framework to understand how to use it all. Then to create a new task, all you have to do is extend the CronInterface.
voice your opinion now!
zendframework task cron tutorial plugin interface
Vinu Thomas' Blog: Fixing the "Missed Schedule" problem in Wordpress
by Chris Cornutt December 31, 2009 @ 13:13:28
Vinu Thomas has posted a tip for WordPress users working with scheduled posts and the "Missing Status" status that's caused by a bug in WordPress.
Ever since the upgrade to Wordpress 2.9, I've been having a problem in the scheduled posts in Wordpress. Everytime I set a post to be scheduled in the future, it used to miss the scheduled time and never get posted. When I checked the status of these posts in the posts admin area, each of these posts had the status "Missed Schedule" next to them.
To correct the issue, you need to make a change to the cron.php script for your installation (in wp-includes) to change the default timeout by quite a bit to ensure that the remote call has plenty of time to finish. It seems its related to the version of PHP's curl extension that's compiled into the web server installation.
voice your opinion now!
wordpress cron missed schedule timeout
Abhinav Singh's Blog: How to use locks in PHP cron jobs to avoid cron overlaps
by Chris Cornutt December 29, 2009 @ 12:45:31
In this new post from Abhinav Singh on how to use file locking to keep your cron jobs from trying to use the same resources.
Cron jobs are hidden building blocks for most of the websites. They are generally used to process/aggregate data in the background. However as a website starts to grow and there is gigabytes of data to be processed by every cron job, chances are that our cron jobs might overlap and possibly corrupt our data. In this blog post, I will demonstrate how can we avoid such overlaps by using simple locking techniques. I will also discuss a few edge cases we need to consider while using locks to avoid overlap.
He includes some sample code - both the class to create the functionality and a script showing how to make use of it (and, of course, an example of it in use).
voice your opinion now!
cron file lock tutorial
WPEngineer.com: Use WordPress Cron
by Chris Cornutt December 18, 2009 @ 12:40:25
This new post from the WPEngineer site gives you a few tips on using the event scheduling (cron) that the default WordPress installation already has built in.
WordPress has its own cron to automatically and scheduled run certain themes. Therefore WordPress provides several functions to use the cron.
In their example they show how to define the task to be executed hourly (sending an email), removing it from the task list and how to define a few more time fields (custom intervals). You can find out more about these event scheduling functions on this page of the WordPress codex site
voice your opinion now!
wordpress cron schedule event
Dhiraj Patra's Blog: Running PHP Scripts with Cron
by Chris Cornutt August 05, 2008 @ 08:45:03
Dhiraj Patra has posted a tutorial to his "LAM-PHP" blog today looking at a different-than-usual way for running PHP scripts - in the cron.
Lots of programmers like PHP for its ability to code and develop web applications fast. Code-debugging is a lot easier than with PERL or C. However, there is one thing a lot of developers are puzzled about, "How to run PHP Scripts with crontab?"
He explains how cron can be used effectively to replace including a backend script into another file (bad practice) and how to get started with PHP and cron. He includes how to find if you're using a CGI or Apache version of PHP and how to locate the binary. He takes this knowledge and shows how to apply it and put a sample script into the cron file. You can check out sites like this or this for more information on cron itself.
voice your opinion now!
script cron crontab cgi apache module binary tutorial
Developer Tutorials Blog: Running PHP cron jobs - regular scheduled tasks in PHP
by Chris Cornutt May 16, 2008 @ 09:32:25
On the Developer Tutorials blog, Akash Mehta has posted an introduction to working with command-line PHP scripts and cron jobs for site automation.
Scheduled tasks are a fairly common feature in modern web applications. From cleaning out caches every 24 hours to checking subscription periods and even generating reports, more web applications live by the clock than ever before. But how do we schedule the execution of a PHP script on the server side?
He shows the two key things to getting it working - an example of a command-line call to a PHP script (executed through his /usr/bin/php) and an example of a line from a crontab showing how to execute the script at midnight every day.
voice your opinion now!
cron job crontab commandline execute schedule task tutorial
PhPL33t Blog: How to Automated Plesk Email Creation
by Chris Cornutt April 24, 2008 @ 10:25:31
On the PhPL33t blog, there's a guide for automating the creation of email addresses with the Plesk administration application:
In 2003 I wrote "Plesk Auto Email", the first fully funtional Plesk email automation suite. Now, I am going to show you how to do it. You will need a dedicated server with Linux, Plesk 7.5 and higher, php5, mysql5, and root access. This will show you how to code the auto creation, I am not going into deletions and edits at this time because I don't have all night to blog.
Included are the database table to store the commands in, the PHP script to create the commands (the integration into the other piece of software) and the PHP cron script that looks in the command table and executes each as it goes through.
voice your opinion now!
tutorial automate plesk email create cron command database tutorial
|
Community Events
Don't see your event here? Let us know!
|