# Twelve-Factor WordPress App #6: Processes

Factor #6: [Processes](https://12factor.net/processes)

## Execute the app as one or more stateless processes

> The app is executed in the execution environment as one or more processes.

This factor bleeds into the [Run Stage](/twelve-factor-05-build-release-run/) and [Concurrency](/twelve-factor-08-concurrency/) factors a bit, but the most important point is:

> Twelve-factor processes are stateless and share-nothing. Any data that needs to persist must be stored in a stateful backing service, typically a database.

There's two main issues you'll run into with making sure WordPress is stateless and sharing nothing:

- Sessions
- Uploaded files

### Sessions

If you need to go beyond normal Cookies (which are stored in the user's browser) and into session territory (stored on the server), you can't use the normal PHP file-based session store. A backing service like MySQL, Redis, or Memcached is required.

### Uploaded Files

Again, this gets into [Concurrency](/twelve-factor-08-concurrency/), but if you're using multiple web servers for your site, you can't just use locally uploaded files. You'll either need an internal storage host like NFS, or an external one such as Amazon S3.

## In Practice

To give an example of how you'd solve each of the issues above, we'll look into some libraries and plugins to use.

### Files

There's a wide variety of plugins and it depends on if you're using an internal or 3rd party store and what it is. But a few examples are [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/) (which also does a million other things), or the more specific [Amazon S3 and CloudFront](https://wordpress.org/plugins/amazon-s3-and-cloudfront/). Both of these also have the benefit is letting you use a CDN in front of your static files as well.

### Sessions

Once again this depends on the backing service you use, but you could easily use a library like [Predis](https://github.com/phpredis/phpredis) (using Composer of course).

#### [Turning a WordPress site into a Twelve-Factor App](/twelve-factor-wordpress/)

1. [Codebase](/twelve-factor-01-codebase/)
2. [Dependencies](/twelve-factor-02-dependencies/)
3. [Config](/twelve-factor-03-config/)
4. [Backing Services](/twelve-factor-04-backing-services/)
5. [Build, release, run](/twelve-factor-05-build-release-run/)
6. **[Processes](/twelve-factor-06-processes/)**
7. [Port binding](/twelve-factor-07-port-binding/)
8. [Concurrency](/twelve-factor-08-concurrency/)
9. [Disposability](/twelve-factor-09-disposability/)
10. [Dev/prod parity](/twelve-factor-10-dev-prod-parity/)
11. [Logs](/twelve-factor-11-logs/)
12. [Admin processes](/twelve-factor-12-admin-processes/)

Want to turn your WordPress site into a Twelve-factor App? [**Bedrock**](/bedrock/) is a modern WordPress stack to help you get started with the best tools and practices.