473,671 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

max_execution_t ime and fork

I use recursive readdir as the engine for
a numerous file processing routines, including
generating thumbnails, using getimagesize
imagecreatetrue color 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_t ime 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 2039
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...@isr elative.comwrot e:
I use recursive readdir as the engine for
a numerous file processing routines, including
generating thumbnails, using getimagesize
imagecreatetrue color 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_t ime 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...@isr elative.comwrot e:
I use recursive readdir as the engine for
a numerous file processing routines, including
generating thumbnails, using getimagesize
imagecreatetrue color 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_t ime 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...@isr elative.comwrot e:
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
8374
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 directive using the -d switch. However, that switch seems to be ignored: #!/usr/bin/php -d max_execution_time=1 -q <? ........ ?>
4
5903
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
2394
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
5965
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(); value = value + 2; number = number + 2;
11
8270
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
5073
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 suggested in a faq, but it still doesnt seem to work. Below is what I have done: pid = fork() if (pid == 0){ printf ("http://my.wait.page"); exit (100);
3
2713
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 main() { .... pid1 = fork(); if (pid1) pid2 = fork(); .....
5
12223
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 recently explained it to a friend of mine and at that time decided to see if I could replicate it in C#. I have created an application that, to me at least, mimics what fork would/should do on *nix/bsd systems. I know that fork spawns a new...
3
5679
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 process I launch with execv the pppd to connect an embedded system to internet. The problem is that pppd fails. I have made two test program just to discard bugs (my applications is really big) and the result is that when I call execv from a...
0
8473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8911
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5692
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2808
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 we have to send another system
2
1806
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.