473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

-d max_execution_time

I'm writing a shell script under Red Hat 9 that will process some thousand
records from a database so it'll normally take several minutes. According
to manual I can override the max_execution_time directive using the -d
switch. However, that switch seems to be ignored:

#!/usr/bin/php -d max_execution_time=1 -q

<?
........
?>

No matter what value I write (0, 1, 9999...) the script stops after 30
seconds:

Maximum execution time of 30 seconds exceeded

The scripts runs as root and PHP is not using safe mode. I'm probably
missing something but I can't figure out what it is. Thank you in advance
for any clue,

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #1
7 8352
Alvaro G Vicario wrote:
I'm writing a shell script under Red Hat 9 that will process some thousand
records from a database so it'll normally take several minutes. According
to manual I can override the max_execution_time directive using the -d
switch. However, that switch seems to be ignored:

#!/usr/bin/php -d max_execution_time=1 -q

<?
.......
?>

No matter what value I write (0, 1, 9999...) the script stops after 30
seconds:

Maximum execution time of 30 seconds exceeded

The scripts runs as root and PHP is not using safe mode. I'm probably
missing something but I can't figure out what it is. Thank you in advance
for any clue,


Can't you add set_time_limit(0) to the php script?

Jul 17 '05 #2
Alvaro G Vicario wrote:
I'm writing a shell script under Red Hat 9 that will process some thousand
records from a database so it'll normally take several minutes. According
to manual I can override the max_execution_time directive using the -d
switch. However, that switch seems to be ignored:

#!/usr/bin/php -d max_execution_time=1 -q

<?
.......
?>

No matter what value I write (0, 1, 9999...) the script stops after 30
seconds:

Maximum execution time of 30 seconds exceeded

The scripts runs as root and PHP is not using safe mode. I'm probably
missing something but I can't figure out what it is. Thank you in advance
for any clue,

--


I guess PHP does not recognize options in the #! line
try

#!/usr/bin/php
<?php
ini_set('max_execution_time', 0);
// rest of script
?>
But php should assume max_exexcution_time = 0 when running from the
command-line. I tried

$ php -r '$x = ini_get("max_execution_time"); echo "$x\n";'
0

$ php -d max_execution_time=456 -r '$x = ini_get("max_execution_time"); echo "$x\n";'
456

--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
Jul 17 '05 #3
*** Pedro Graca wrote/escribió (27 Nov 2003 10:58:36 GMT):
I guess PHP does not recognize options in the #! line try
ini_set('max_execution_time', 0);
You are right, it seems PHP got confused by what you say. And I got
confused because it certainly does accept the -q switch. Now it works fine.
But php should assume max_exexcution_time = 0 when running from the
command-line.


# php -r '$x = ini_get("max_execution_time"); echo "$x\n";'
Error in argument 1, char 2: option not found r
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}

I have the PHP packages bundled with Red Hat 9, it must be they are either
an older version or they are built with different options... :-?

Thank you for your help,
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #4
Alvaro G Vicario wrote:
But php should assume max_exexcution_time = 0 when running from the
command-line.


# php -r '$x = ini_get("max_execution_time"); echo "$x\n";'
Error in argument 1, char 2: option not found r
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}

I have the PHP packages bundled with Red Hat 9, it must be they are either
an older version or they are built with different options... :-?


I think you're using the CGI SAPI. I can't test that here.

$ php -v
PHP 4.3.3 (cli) (built: Nov 19 2003 23:12:29)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

$ php -h
Usage: php [options] [-f] <file> [args...]
php [options] -r <code> [args...]
....
-r <code> Run PHP <code> without using script tags <?..?>
-s Display colour syntax highlighted source.
-v Version number
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
Jul 17 '05 #5
*** Pedro Graca wrote/escribió (27 Nov 2003 11:40:06 GMT):
I think you're using the CGI SAPI. I can't test that here.

$ php -v
PHP 4.3.3 (cli) (built: Nov 19 2003 23:12:29)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
# php -v
4.2.2


$ php -h
Usage: php [options] [-f] <file> [args...]
php [options] -r <code> [args...]
...
-r <code> Run PHP <code> without using script tags <?..?>
-s Display colour syntax highlighted source.
-v Version number


# php -h
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>] | {<file> [args...]}
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-w Display source with stripped comments and whitespace.
-f <file> Parse <file>. Implies `-q'
-v Version number
-C Do not chdir to the script's directory
-c <path> Look for php.ini file in this directory
-a Run interactively
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-z <file> Load Zend extension <file>.
-l Syntax check only (lint)
-m Show compiled in modules
-i PHP information
-h This help
The funny thing is that I can't find any "cli" packet in Red Hat
repositories. Never mind, it works so it's fine :)

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #6
Alvaro G Vicario wrote:
The funny thing is that I can't find any "cli" packet in Red Hat
repositories. Never mind, it works so it's fine :)


With Debian I did:

# apt-get install php4-cgi

Maybe the package name is cgi also on Red-Hat, if you want to install
it.
Anyway, glad you have it working
--
--= my mail address only accepts =--
--= Content-Type: text/plain =--
Jul 17 '05 #7
jeva
2
try using the set_time_limit(int seconds) function



I'm writing a shell script under Red Hat 9 that will process some thousand
records from a database so it'll normally take several minutes. According
to manual I can override the max_execution_time directive using the -d
switch. However, that switch seems to be ignored:

#!/usr/bin/php -d max_execution_time=1 -q

<?
........
?>

No matter what value I write (0, 1, 9999...) the script stops after 30
seconds:

Maximum execution time of 30 seconds exceeded

The scripts runs as root and PHP is not using safe mode. I'm probably
missing something but I can't figure out what it is. Thank you in advance
for any clue,

--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jun 30 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Newbie Von Greenhorn | last post by:
Is anyone else having this problem? Remember with CGI php.exe you could set the timeout in IIS? It seems to me (after much searching) that you can't set the ISAPI timeout in IIS. I think it...
4
by: John Pastrovick | last post by:
When writing an HTML table after a PHP database query very occasionally (1 out of ten times -- same code) the HTML page is truncated and cells/or full final rows of table are missing. Looking at...
2
by: Dynamo | last post by:
Hi Can somebody tell me how to change the max_input_time when uploading large images from my local PC to the server. Also how do I change the max_execution_time? Regards Dynamo
2
by: alex | last post by:
Hi, I've got a problem with a script that needs about 1 minute to run as the max_execution_time is set to 30 seconds only. I don't have the rights to modify the max_execution_time parameter on...
6
by: Charles Crume | last post by:
Hello all; I set "max_execution_time = 120" in my php.ini file so that some lengthy php routines in my auction software would have time to complete when automatically relisting lots of items. ...
1
by: Xristos Nikolopoulos | last post by:
Hello, I have made an application that needs to upload files, the application is deployed in several folders, and each folder has its php files. The problem is, I have in the folder I want to...
2
by: comp.lang.php | last post by:
I have an app that is going berzerk on its own; without any code or environmental changes of any kind, for some bizarre reason it will randomly just hang, spawn multiple Apache processes and...
5
by: sandy | last post by:
I use recursive readdir as the engine for a numerous file processing routines, including generating thumbnails, using getimagesize imagecreatetruecolor and imagejpeg, etc. where each resize...
0
by: robin1323 | last post by:
I have a php script on my site... which lets people download files through my site.... but download does not complete ... it stops in between ... if suppose file is of 99 mb download would stop...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.