We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

FastCGI / CGI - php-cgi.exe - Memory usageRSS

4 replies

Last post Jan 02, 2019 02:59 AM by Brando Zhang

  • FastCGI / CGI - php-cgi.exe - Memory usage

    Dec 31, 2018 09:22 AM|SteveNHT|LINK

    Hi

    We are running IIS 8 on a MS Server 2012 machine with FastCGI PHP (5.6).

    As the website is being used (it is an intranet site using PHP / MySQL) multiple new Fast CGI/CGI processes are invoked (php-cgi.exe) - I assume relating to the number of concurrent requests.

    Each of these processes is allocating 600MB of memory.

    I am using a small number of extensions (mysqli, curl, exif, gd, mbstring) and the memory limit in PHP is 256MB. If I reduce the memory limit, I can't even view a basic phpinfo page - a FastCGI error is returned.

    Is 600MB for each FastCGI process to be expected? If not, any thoughts about why this might be happening?

    Thank you.

  • Re: FastCGI / CGI - php-cgi.exe - Memory usage

    Dec 31, 2018 04:33 PM|lextm|LINK

    https://blog.lextudio.com/who-should-be-contacted-for-php-on-iis-issues-c80b90bd365

    The process php-cgi.exe is the one who executes your PHP code. So its memory usage is fully controlled by the PHP application. Whether 600MB is reasonable can only be answered by the original developers/vendors.

    BTW, PHP 5.6 support just expired, http://php.net/supported-versions.php so ideally you should upgrade to 7.2 or 7.3 and test again.

    Lex Li
    Want to have a chat on the issues you meet? Book an appointment at https://buy.stripe.com/cN24ia0yi7sAdIA7sv
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: FastCGI / CGI - php-cgi.exe - Memory usage

    Jan 01, 2019 03:26 AM|Brando Zhang|LINK

    Hi SteveNHT,
    As lextm says, the php-cgi.exe memory usage is according to your php application size.

    If you want to reduce the memory usage for the php-cgi.exe, I suggest you could try below ways:

    1.php.ini - located in the root folder. Edit in TextPad and change the value for momory_limit. if 4M is not enough up to 8M, etc.
    2.In admin.php (if your error is in here) add a memory limit line after ini_set 'memory_limit', '12M' if 12MB of memory is what you're looking to add
    3.You can add a line to .htaccess: php_value memory_limit 32M
    4.wp-config.php can control memory. You put a line in that looks like this define('WP_MEMORY_LIMIT', '32M');

    Best Regards,

    Brando

  • Re: FastCGI / CGI - php-cgi.exe - Memory usage

    Jan 01, 2019 10:27 AM|SteveNHT|LINK

    Hi! Thanks for the reply.

    I have upgraded to 7.3 and this seems to have solved the problem. It's created other problems but I'll work through these.

    Many thanks,

    Steve

  • Re: FastCGI / CGI - php-cgi.exe - Memory usage

    Jan 02, 2019 02:59 AM|Brando Zhang|LINK

    Hi SteveNHT,

    I'm glad that you have solved your issuem, I suggest you could mark the answer which is helpful. This will help other people who faces the same issue to find the right answer more faster.

    Best Regards,

    Brando