473,372 Members | 1,083 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,372 software developers and data experts.

serious problem need help.

Hi all,
I'm having troubles with my hosting and for a few reasons I can't change.

So here is my problem: I receive XML files with images included in the file.
I've to parse the file, save datas in a database and save images after
resizing them. The whole process takes sometimes more than 10 seconds (the
limit of the scripts) so I've errors.

It's there any way to have an other process that do the image processing
(like an automatic "post" wich send the images) ? How ? Exec isnt' allowed
on the server.

Please help....

Bob

Oct 17 '06 #1
15 1499
Hmm Bob Bedford <bo*@bedford.comwrote:
images after resizing them. The whole process takes sometimes more
than 10 seconds (the limit of the scripts) so I've errors.
then you should to set new time limit for script execution
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

2be || !2be $this =mysql_query();
Oct 17 '06 #2
then you should to set new time limit for script execution

Obviously you guess I can't do it !!! I can't modify anything in the server
settings.

Bob

Oct 17 '06 #3
Hmm Bob Bedford <bo*@bedford.comwrote:
>then you should to set new time limit for script execution

Obviously you guess I can't do it !!! I can't modify anything in the
server settings.

why?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

2be || !2be $this =mysql_query();
Oct 17 '06 #4

Bob Bedford wrote:
then you should to set new time limit for script execution

Obviously you guess I can't do it !!! I can't modify anything in the server
settings.

Bob
Some hosts let you change the timeout using ini_set, does yours?

If not could you split the processing over two scripts?

In the first script parse the xml file, update database, copy the image
to a temporary file and use $_SESSION to store the temp filename. Then
redirect to the second script using header('Location:') and let the 2nd
script finish off the resizing & database updates

This way you have a whole twenty seconds to play with.

Oct 17 '06 #5
..:[ ikciu ]:. wrote:
Hmm Bob Bedford <bo*@bedford.comwrote:
>>then you should to set new time limit for script execution

Obviously you guess I can't do it !!! I can't modify anything in the
server settings.


why?
he can't, thats it. Maybe he has a shared hosting service.
Bob, I heared of a method how the script calles itself if the execution-time
reaches a limit. Maybe that could be helpfull. I saw it in a script, but i
don't remember its name, it was about mysql, mysqldump or something like
that.
Stefan
Oct 17 '06 #6
Some hosts let you change the timeout using ini_set, does yours?
No, id doesn't allow using ini_set. (it would be too simple).
If not could you split the processing over two scripts?
That's the way I'm looking for.
>
In the first script parse the xml file, update database, copy the image
to a temporary file and use $_SESSION to store the temp filename. Then
redirect to the second script using header('Location:') and let the 2nd
script finish off the resizing & database updates

This way you have a whole twenty seconds to play with.
It's there any way in PHP to execute (without using location as it changes
page) a new page ? I don't have access to exec()...
My idea is to manage the recording in the database then every time I've new
images, send them to a new script. The main process will do easely in 10
seconds then every process will redim and save the images (time consuming)
and it may also do it in 10 seconds.

Problem: I don't know how to do so (launch an other script without exec)
passing the files (like a normal post or get will do).

Bob

Oct 17 '06 #7

Bob Bedford wrote:
Hi all,
I'm having troubles with my hosting and for a few reasons I can't change.

So here is my problem: I receive XML files with images included in the file.
I've to parse the file, save datas in a database and save images after
resizing them. The whole process takes sometimes more than 10 seconds (the
limit of the scripts) so I've errors.

It's there any way to have an other process that do the image processing
(like an automatic "post" wich send the images) ? How ? Exec isnt' allowed
on the server.

Please help....

Bob
Do you have access to CRON? If so, you could parse the xml upon
retrieval and store the paths to the images to be redimensioned in a
table queue. You could then have a cron script run once a minute or
(as often as necessary) to try and clear out the queue.

Oct 17 '06 #8
Daz

Moot wrote:
Do you have access to CRON? If so, you could parse the xml upon
retrieval and store the paths to the images to be redimensioned in a
table queue. You could then have a cron script run once a minute or
(as often as necessary) to try and clear out the queue.
Another alternative to CRON, would be to create a script that checks if
anything needs to be done every time a page is clicked upon. It can be
as simple as adding a function call or include() to the pages you want
to act as the trigger. It's more of an advantage when you get heavier
traffic on a website, but it's a possibility. I think the best place to
add a trigger, would be to the footer (if you use one) which would be
appended to every page, and trigger last thing, so it wouldn't
interfere with the page generation for the user.

Oct 17 '06 #9

Bob Bedford wrote:
Some hosts let you change the timeout using ini_set, does yours?
No, id doesn't allow using ini_set. (it would be too simple).
If not could you split the processing over two scripts?
That's the way I'm looking for.

In the first script parse the xml file, update database, copy the image
to a temporary file and use $_SESSION to store the temp filename. Then
redirect to the second script using header('Location:') and let the 2nd
script finish off the resizing & database updates

This way you have a whole twenty seconds to play with.
It's there any way in PHP to execute (without using location as it changes
page) a new page ? I don't have access to exec()...
My idea is to manage the recording in the database then every time I've new
images, send them to a new script. The main process will do easely in 10
seconds then every process will redim and save the images (time consuming)
and it may also do it in 10 seconds.

Problem: I don't know how to do so (launch an other script without exec)
passing the files (like a normal post or get will do).
You can curl or sockets to post data to another script

http://uk.php.net/manual/en/ref.curl.php
http://uk.php.net/manual/en/function.fsockopen.php.

The 1st script may timeout waiting for the response, I dont think this
will affect the execution of the 2nd script, as long as the 2nd script
starts before the 1st timeouts. A best guess not a guarantee..

Oct 17 '06 #10
Bob Bedford wrote:
>>Some hosts let you change the timeout using ini_set, does yours?

No, id doesn't allow using ini_set. (it would be too simple).

>>If not could you split the processing over two scripts?

That's the way I'm looking for.

>>In the first script parse the xml file, update database, copy the image
to a temporary file and use $_SESSION to store the temp filename. Then
redirect to the second script using header('Location:') and let the 2nd
script finish off the resizing & database updates

This way you have a whole twenty seconds to play with.

It's there any way in PHP to execute (without using location as it changes
page) a new page ? I don't have access to exec()...
My idea is to manage the recording in the database then every time I've new
images, send them to a new script. The main process will do easely in 10
seconds then every process will redim and save the images (time consuming)
and it may also do it in 10 seconds.

Problem: I don't know how to do so (launch an other script without exec)
passing the files (like a normal post or get will do).

Bob
Bob,

You don't "launch another page with exec()". Rather, you redirect to
the new page with header('Location: pagename').

Just be sure you don't create any output before this. And you can save
the data you're working on in the session (or pass it as GET parameters).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 17 '06 #11
Hmm Bob Bedford <bo*@bedford.comwrote:
>then you should to set new time limit for script execution
..htaccess or ini_set()
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

2be || !2be $this =mysql_query();
Oct 17 '06 #12
Rik
Daz wrote:
Moot wrote:
>Do you have access to CRON? If so, you could parse the xml upon
retrieval and store the paths to the images to be redimensioned in a
table queue. You could then have a cron script run once a minute or
(as often as necessary) to try and clear out the queue.

Another alternative to CRON, would be to create a script that checks
if anything needs to be done every time a page is clicked upon. It
can be as simple as adding a function call or include() to the pages
you want to act as the trigger. It's more of an advantage when you
get heavier traffic on a website, but it's a possibility. I think the
best place to add a trigger, would be to the footer (if you use one)
which would be appended to every page, and trigger last thing, so it
wouldn't interfere with the page generation for the user.
Yup, perhaps flush(), and maybe on more traffic (allthough, on more traffic
an other hoster might be more helpfull), create a possibility it's fired:

if(rand(0,99) == 1){
//run script
}

--
Rik Wasmus
Oct 18 '06 #13
You can curl or sockets to post data to another script
>
http://uk.php.net/manual/en/ref.curl.php
http://uk.php.net/manual/en/function.fsockopen.php.

The 1st script may timeout waiting for the response, I dont think this
will affect the execution of the 2nd script, as long as the 2nd script
starts before the 1st timeouts. A best guess not a guarantee..
Thanks for your reply, I'll have a look at this solution.

Cheers

Oct 18 '06 #14
You don't "launch another page with exec()". Rather, you redirect to the
new page with header('Location: pagename').

Just be sure you don't create any output before this. And you can save
the data you're working on in the session (or pass it as GET parameters).
I wanted to avoid to redirect as I've to pass by all records I've already
done every time I call the script again and this will be very long.

I've got an other answer it has been said to "refresh" the page. Will first
look at fsockopen then at this solution. Maybe I'll do both.

Thanks.

Bob

Oct 18 '06 #15
Bob Bedford wrote:
>>You don't "launch another page with exec()". Rather, you redirect to the
new page with header('Location: pagename').

Just be sure you don't create any output before this. And you can save
the data you're working on in the session (or pass it as GET parameters).


I wanted to avoid to redirect as I've to pass by all records I've already
done every time I call the script again and this will be very long.

I've got an other answer it has been said to "refresh" the page. Will first
look at fsockopen then at this solution. Maybe I'll do both.

Thanks.

Bob
Yes, I understand it would be a hassle to skip over already-processed
records. It's one reason I suggested saving the info in your session.
Once you've processed a record you can remove it from the "to be
processed" list (and if necessary add it to a "completed" list).

Refresh is just redirect to the same page, which you can do, also. But
fsockopen() won't help. The process doing the fsockopen() will still
time out after 10 seconds. You need to actually transfer control to
another page (or the same one again).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 18 '06 #16

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

Similar topics

142
by: Herr Lucifer | last post by:
As the founder of .NET framework, Microsoft claims that it invention will be the next best platform for programming in a near future. Now it is 2005, ..NET is 5 years old, and can talk and walk for...
2
by: Leveridge Systems INC | last post by:
We're in desperate need of contract help for c++/ linux or Unix based talent. 6 month need .. we have budget for a serious coder.. so the dollars are there. anyways.. may be of help to a...
1
by: iceColdFire | last post by:
Hi, I am into C++ compiler validation since past couple of years. Lately I have grown with a strange feeling...while on the course of my work, I start getting bored and very bored...I have...
12
by: Sunny | last post by:
Hi All, I have a serious issue regarding classes scope and visibility. In my application, i have a class name "TextFile", and also a few other classes like "TotalWords", "TotalLines" and etc..,...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
2
by: WJ | last post by:
This post is a follow up from the original post dated Oct 16, 2004 "I have this problem, pls help!" created by Paul FI. These bugs are rather serious and we would like to know how to get around. ...
1
by: Juan Alvarez | last post by:
hi, everyone, I have a serious problem here, i need to make a program using Regular Expressions in C in Dev-C++. I found some tutorials but all the links are broken :S i have 5 days looking for...
69
by: Edward K Ream | last post by:
The pros and cons of making 'print' a function in Python 3.x are well discussed at: http://mail.python.org/pipermail/python-dev/2005-September/056154.html Alas, it appears that the effect of...
1
by: Johnson545236 | last post by:
I need some serious help. I'm extremely new to vs 2003 .net and I have to work with CRM, sigh. I am trying my first program and I get this error: Description: An error occurred during the...
1
by: Guy Macon | last post by:
Serious Security Flaw in Google Chrome: http://www.readwriteweb.com/archives/security_flaw_in_google_chrome.php -- Guy Macon <http://www.GuyMacon.com/>
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.