As Barmar stated above, different PHP.ini files are used for the two versions.
Is the CLI version running in safe mode?
The max_execution_time may not be set at runtime with ini_set() in safe mode. Also, the CLI version defaults to 0 for its execution time limit.