Skip to content

Instantly share code, notes, and snippets.

@userid
Created March 30, 2017 04:03
Show Gist options
  • Select an option

  • Save userid/d73b42de357eec26ce9396ee6da986cd to your computer and use it in GitHub Desktop.

Select an option

Save userid/d73b42de357eec26ce9396ee6da986cd to your computer and use it in GitHub Desktop.

This simple code will freeze php-fpm:

cat /tmp/php-apcu/apcu.php

<?php
while (1 != 0) {
    apcu_store ("mykey", "123qwe");
    apcu_fetch ("mykey");
}

If you have request_terminate_timeout = 3, you can run apcu.php with this code:

cat /tmp/php-apcu/apcu/sh

#!/bin/sh
while [ 0 != 1 ]; do
    SCRIPT_FILENAME=/tmp/php-apcu/apcu.php \
    REQUEST_METHOD=GET \
    cgi-fcgi -bind -connect 127.0.0.1:9000
    sleep 3
done

cgi-fcgi is a tool, that allows you to run code on php-fpm directly, without webserver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment