PHP Fatal error: Maximum execution time of -1 seconds exceeded

php-fpmtimeout

I have a script which has a long running MySQL query and PHP returns a huge number of records as it is used to fetch raw logs for users.

I am finding it a little strange but i am getting time out after setting max_execution_time = -1.

I have also set max_input_time = -1 and memory_limit = -1 to make it work atleast for testing server.

Server has php5-fpm. Have also done multiple restarts with service php5-fpm restart.

What can be the issue here?