CJ Sculti
CJ Sculti

Reputation: 761

PHP mod_fcgi with fastcgi_finish_request();

I want to use the fastcgi_finish_request() function.

I have CPanel installed on my server and PHP and Apache are both configured through that. Since I cannot edit Apache or PHP configuration manually (because of CPanel), I used easyApache in WHM to build it in order to get fastcgi.

I saw an option caled Mod FCGID, so I enabled it.

After rebuilding PHP and Apache with that option enabled, I still get call to undefined function when calling the fastcgi_finish_request function.

Upvotes: 4

Views: 7787

Answers (2)

vince
vince

Reputation: 159

A little late, but good info for people. In my experience working with PHP 5.5.7.

PHP using mod_php (standard Apache):

ob_start();
header("Connection: close\r\n"); 
header('Content-Encoding: none\r\n');

// your code here

$size = ob_get_length();
header("Content-Length: ". $size . "\r\n"); 
// send info immediately and close connection
ob_end_flush();
flush();

// run other process without the client attached.

For PHP using FastCGI and PHP_FPM:

// your code here

fastcgi_finish_request();

// run other process without the client attached.

Note that for us, after fastcgi_finish_request() was executed, log_error no longer worked. I assume it is because the connection to Apache is also severed and it cannot communicate with FastCGI to log the error.

Upvotes: 13

dev-null-dweller
dev-null-dweller

Reputation: 29462

fastcgi_finish_request is PHP-FPM SAPI specific function, unavailable in standard php-fcgi binary (used by Apache [mod_fcgid, mod_fastcgi], nginx, lighttpd etc).

Upvotes: 8

Related Questions