Increase Memory Allocated to PHP in WordPress hosted on Microsoft Azure App Services on Linux


“It became clear that we needed to support the Linux operating system, and we had already taken some rudimentary steps towards that with Azure.”

This is what Satya Nadella, Microsoft CEO, said in his book Hit Refresh. With the change he announced, today we can host a WordPress site easily on Microsoft Azure with the App Service on Linux option. Currently, my team has made use of this function on Azure to host our WordPress sites.

This morning, I received a message from teammate with the following screenshot asking how to get rid of the following red messages.

Memory issues on WordPress!

This only happened after we installed a new theme called G5Theme for our WordPress site. The theme that we are using is called G5Plus Mowasalat.

So how do we approach this problem. Even though the three red lines are linked to the same “Increasing memory allocated to PHP“, there are fundamentally two places that we need to change.

Firstly, we need to add the following line to increase the WP_MEMORY_LIMIT to 128M in wp-config.php.

define('WP_MEMORY_LIMIT', '128M');
Released with WordPress 2.5, the WP_MEMORY_LIMIT option allows us to specify the maximum amount of memory that can be consumed by PHP.
The file is located under /site/wwwroot directory, as shown in the FTP screenshot below.
This is where wp-config.php is located.

Changing this will only remove the first two red lines.

For the issue highlighted by the third red line, we need to update the max_input_vars value in .htaccess file which is located at the same directory with the following line.

php_value max_input_vars 3000

This max_input_vars is one of the PHP runtime configurations that is introduced since PHP 5.3.9 with default value of 1,000. What it means is simply the maximum number of input variables can be accepted in for example $_GET and $_POST.

Adding this will remove the final red line and everything will be shown green.

Hola! All are green.

Same article is posted on the author’s personal blog.

Featured Image: Satya Nadella announcing the partnership. (Image Credit: The Verge)

About Goh Chun Lin

Inspired by the CVWO (Computing for Voluntary Welfare Organizations) activities in my university years, I enjoy working on projects which bring positive impact to the society. I am currently the CTO in Haulio Pte Ltd. Backed by PSA (pka Port of Singapore Authority), Haulio solves logistics and supply chain problems by making container haulage easier. In Haulio, even though my main focus is web development, I also work on cloud computing, mobile apps, and IoT projects which help improving the traditional industry. As a fan of self-learning, I also choose to spend after office hour to learn new skills and new information in order to keep up with the fast-paced changes in software development field. I have a personal blog sharing my hobby software development projects and sometimes I also contribute as a writer on Microsoft Singapore Spiffy blog. I also participate in Singapore .NET Developers Community as an event co-organizer and speaker. I love to share my .NET and Microsoft Azure web development journey during the meetups.

View all posts by Goh Chun Lin →

2 Comments on “Increase Memory Allocated to PHP in WordPress hosted on Microsoft Azure App Services on Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *