user1322720
user1322720

Reputation:

How to get PHP max_execution_time from the command line?

When I run a script in the browser, I can get the time limit that is set in the configuration with:

ini_get('max_execution_time');

When I run a script from the command line, I can set the time limit with:

php -d max_execution_time=5 script.php

But how can I get the maximum execution time in the command line?

Upvotes: 17

Views: 19838

Answers (2)

Ties
Ties

Reputation: 805

PHP>=5.2

$ php -r "echo ini_get('max_execution_time') . PHP_EOL;";

PHP<5.2

$ echo "<?php echo ini_get('max_execution_time') . PHP_EOL;" | php 

Upvotes: 4

Wizard
Wizard

Reputation: 11285

PHP cli by default not have max_execution_time limit

You can get by running:

php -i | grep max_execution_time

Upvotes: 25

Related Questions