473,512 Members | 14,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

max_execution_time and fork

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 operation involves instantiating
a new resizer class instance.

.....but my (shared host) website is large, so I
run past max_execution_time if I try to make
all thumbnails at once, from the top of
my document_root. My virtual file system
includes a php.ini which I can edit, but
bumping max_execution-time (although the file saves)
seems to have no effect, and I do not have
permission to run /usr/sbin/apachectl restart

Perhaps the php.ini change
will start to work the next time the server reboots.

In the mean time, is there some way to fork a new process,
for instantiating the resizer?

I could try to use exec to run command line
php. But there must be a more elegant way
to do this. I'd use perl and imagemagick,
but my shared host server doesn't have the
right perl libs installed, and that's another
can of worms.
Apr 28 '07 #1
5 2031
why not just generate the thumbnails for the current directory, then
provide navigational links to the sub-directories. I just started on
a photo album system that works in that exact way. http://code.google.com/p/zippyphotos/.
Check it out maybe we can work out some requirements together

On Apr 28, 12:00 am, sandy <relativ...@isrelative.comwrote:
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 operation involves instantiating
a new resizer class instance.

....but my (shared host) website is large, so I
run past max_execution_time if I try to make
all thumbnails at once, from the top of
my document_root. My virtual file system
includes a php.ini which I can edit, but
bumping max_execution-time (although the file saves)
seems to have no effect, and I do not have
permission to run /usr/sbin/apachectl restart

Perhaps the php.ini change
will start to work the next time the server reboots.

In the mean time, is there some way to fork a new process,
for instantiating the resizer?

I could try to use exec to run command line
php. But there must be a more elegant way
to do this. I'd use perl and imagemagick,
but my shared host server doesn't have the
right perl libs installed, and that's another
can of worms.

Apr 28 '07 #2
On Apr 28, 5:00 am, sandy <relativ...@isrelative.comwrote:
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 operation involves instantiating
a new resizer class instance.

....but my (shared host) website is large, so I
run past max_execution_time if I try to make
all thumbnails at once, from the top of
my document_root. My virtual file system
includes a php.ini which I can edit, but
bumping max_execution-time (although the file saves)
seems to have no effect, and I do not have
permission to run /usr/sbin/apachectl restart

Perhaps the php.ini change
will start to work the next time the server reboots.

In the mean time, is there some way to fork a new process,
for instantiating the resizer?

I could try to use exec to run command line
php. But there must be a more elegant way
to do this. I'd use perl and imagemagick,
but my shared host server doesn't have the
right perl libs installed, and that's another
can of worms.
you could obtain a list of the jobs (or folders) to be processed, put
it in a session, then use an iframe within a main page.
the main page loads the iframe and a javascript function which can
refresh the iframe.
the iframe finishes calls processjob.php which completes job1
job1 is removed from the array
the php script outputs <script>parent.refreshIframe()</scriptto the
iframe
the iframe reloads and starts the next job

this is of course a single thread approach, if you want to emulate
more threads, use more iframes where the "parent iframe refresher" now
takes the argument iframename.
don't use too many or you will probably hit other hard limits of
average CPU usage within a certain time, or just RAM.

Apr 28 '07 #3
shimmyshack wrote:
>
you could obtain a list of the jobs (or folders) to be processed, put
it in a session, then use an iframe within a main page.
the main page loads the iframe and a javascript function which can
refresh the iframe.
the iframe finishes calls processjob.php which completes job1
job1 is removed from the array
the php script outputs <script>parent.refreshIframe()</scriptto the
iframe
the iframe reloads and starts the next job
I like that idea. I'll try it.
The best idea would be to get a co-located machine,
or a virtual one, so I control server. In the
meantime that sounds like a workable hack. Thank you.
Apr 28 '07 #4
On Apr 28, 2:00 pm, sandy <relativ...@isrelative.comwrote:
shimmyshack wrote:
you could obtain a list of the jobs (or folders) to be processed, put
it in a session, then use an iframe within a main page.
the main page loads the iframe and a javascript function which can
refresh the iframe.
the iframe finishes calls processjob.php which completes job1
job1 is removed from the array
the php script outputs <script>parent.refreshIframe()</scriptto the
iframe
the iframe reloads and starts the next job

I like that idea. I'll try it.
The best idea would be to get a co-located machine,
or a virtual one, so I control server. In the
meantime that sounds like a workable hack. Thank you.
i like circumventing the resitrictions placed on a shared host, it's
cheaper!
although the above approach is jobs of unit size "folder"
you could have a more fine grained approach where you list every job,
using a database, the iframes would be included in each webapge
provided there are jobs to do, the visitors then start a job if there
are any. Provided you have low volume usage / record the last job
start time in the db, this would be a great "cron" emulator which
might be something else your shared service doesnt allow access to.

Apr 28 '07 #5
shimmyshack wrote:
the iframes would be included in each webapge
provided there are jobs to do, the visitors then start a job if there
are any. Provided you have low volume usage / record the last job
start time in the db, this would be a great "cron" emulator which
might be something else your shared service doesnt allow access to.
Not sure about this. I use a home-rolled cms that reads a
source directory structure, looking for images, image captions,
html fragments, link references, etc, and then initializes
a schema. Then I write out the whole website as static html.
That way I can manage hundreds of sources and pages.

Pages that *have* to be dynamic remain that way. But most
of the site ends up as static html.

.....so this is an admin functionality for me only, not something
I want to let users invoke in anyway.
Apr 28 '07 #6

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

Similar topics

7
8361
by: Alvaro G Vicario | last post by:
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...
4
5885
by: Benoit Dejean | last post by:
hello, i have a question about forking processes atm, i have some code which i want to rewrite os.system("cd ~ && exec " + cmd + " & disown") i want to remove this os.system call
6
2380
by: shellcode | last post by:
the code: ------fork.c------ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main() {
27
5934
by: steve | last post by:
I was given the following code, and asked what the possible outputs could be. We're learning about processes and forking. int value; int main(){ int pid, number = 1; value = 2; pid = fork();...
11
8253
by: ramu | last post by:
Hi All, We know that a c function never returns more than one value. Then how come the fork() function returns two values? How it is implemented? Regards
1
5051
by: vduber6er | last post by:
Hi I want to have a wait page while the rest of the cgi does its process, but it seems like the wait page waits till everything is complete and never appears. I've tried forking twice already as...
3
2708
by: thrillseekersforever | last post by:
The questions(A&B) are to fine no# of process running from the below codes. However, I couldn't decipher the solution. Will someone please throw some light on this? Thanks a lot!! A] void...
5
12206
by: JoeW | last post by:
Now before I go into detail I just want to say that this is purely for my own benefit and has no real world usage. I remember way back when the tool for *nix systems called forkbomb was created. I...
3
5660
by: CMorgan | last post by:
Hi everybody, I am experiencing an annoying problem with fork() and execv(). In my program I need to launch the "pppd" from a thread, so, I create a new process with fork and then in the child...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5079
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.