phpapachefile-get-contentswkhtmltopdfmod-fastcgi

PHP request on self


I experience problem with PHP request on self. In example I will use file_get_contents() but same happen for exec('wkhtmltopdf [*SELF*]') or curl()


1st script

//get-html.php  
file_get_contents('http://example.org/index.html')

2nd script

//get-php.php
file_get_contents('http://example.org/index.php')


Testing
1) command-line: php get-html.php // Success
2) browser: example.org/get-html.php // Success

1) command-line: php get-php.php // Success
2) browser: example.org/get-php.php // Timeout


What I tried next

So my suspect is mod_fastcgi. It seems like the apache is not able to run 2 instances of this to handle PHP requests which comes from itself. As running script from command line works as expected.

Does anybody have any advice?


Solution

  • I did not set PHP_FCGI_CHILDREN what is in default 1.
    When I called in PHP script another PHP script from my server over apache it failed as it was not able to create another PHP FCGI instance.

    Proper settings of PHP_FCGI_CHILDREN