Over a million developers have joined DZone.

Announcing mod_reset for Apache 2.x

In this article, the author covers custom module for Apache 2.x called mod_reset. Check it out here!

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

In the previous post, we wrote about new project Awex. With that in mind, we are happy to announce custom module for Apache 2.x named mod_reset.

What Is mod_reset?

mod_reset is a module for both Apache versions including 2.2 and 2.4. It simply looks at headers you set in Apache configuration and overwrites PHP settings. Let’s say we want to set memory_limit dynamically for certain application, Apache configuration looks like this:

ResetHeaders "memory_limit" "X-Memory-Limit"

This snippet translates to: Look at X-Memory-Limit HTTP header and set value from this header to PHP memory_limit. You might wonder why use this module while there are other solutions like mod_fcgid, mod_lsapi? Because we want to use mod_php, run single PHP version per container and have reverse proxy in front of this fleet of containers. Secondly, mod_fcgid is not developed anymore, while mod_lsapi has to run under CloudLinux which is proprietary and not free.

In addition, this module allows you to overwrite DocumentRoot, ServerAdmin and TMPDIR environment on request from headers too. For instance:

ResetHeader "ServerAdmin" "X-Server-Admin"
ResetHeader "DocumentRoot" "X-Document-Root"

Setting TMPDIR environment per request allows you to make sure client is not using /tmp anymore for temporary files, thus files quota will be calculated more granularly.

If you became interested in mod_reset, grab it on GitHub and try.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:
apache ,php ,hosting

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}