Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:53:09+00:00 2026-06-07T14:53:09+00:00

I have quite an extensive PHP script that I have to run on my

  • 0

I have quite an extensive PHP script that I have to run on my database as well as gather img sizes from the file structure and write that information to an XML file. I have tried running directly from the web browser with minimum success as the Gateway times out after about 3 minutes. I have tries running from an ssh shell as well with no success. here is most of the script

    //Get all galleries from client
            $query = mysql_query("SELECT *
                                    FROM gallery
                                    WHERE clientRef BETWEEN 420
                                    AND 430
                                    ORDER BY clientRef
                                ");

            while ($row = mysql_fetch_array($query)) {

            //set gallery id

            $galleryID =  $row['id'];
            $clientRef = $row['clientRef'];
        //Check image sizes and set horizontal vs vertical
            $fImageSizeName = mysql_fetch_array($qAlbumImages);
            $imageSizeName = $fImageSizeName['OrgImageName'];

            $galleryPath = $_SERVER['DOCUMENT_ROOT'] . "/data/gallery/" . $galleryID . "/images/"; 

            if(is_dir($galleryPath)) {
                list($width, $height) = getimagesize($_SERVER['DOCUMENT_ROOT'] . "/data/gallery/" . $galleryID . "/images/album/" . $imageSizeName);

    header("Content-Type: text/plain");


        //Create the xml document
        $xmlDoc = new DOMDocument();

        //Create the root Element
        $root = $xmlDoc->appendChild(
                $xmlDoc->createElement("PageflipDataSet"));
        //Create settings element
        $settings = $root->appendChild(
                    $xmlDoc->createElement("Settings"));
    //Create PageOrder Node
        $PageOrder = $root->appendChild(
                    $xmlDoc->createElement("PageOrder"));

        $qAlbumImages = mysql_query("   SELECT *
                                        FROM galleryimage 
                                        WHERE galleryId='{$galleryID}' 
                                        AND clientRef= '{$clientRef}' 
                                        ORDER BY sort
                                    ");

        while ($fAlbumImages = mysql_fetch_array($qAlbumImages)) {
            $path  = "../../../../data/gallery/" . $galleryID . "/images/album/" . $fAlbumImages['OrgImageName'];
            //Create the PageData Node
            $PageData = $PageOrder->appendChild(
                        $xmlDoc->createElement("PageData"));
                //PageFile attribute
                $PageData->appendChild(
                        $xmlDoc->createAttribute("PageFile"))->appendChild(
                        $xmlDoc->createTextNode($path));
        }//close while

//Format output so it looks pretty
    $xmlDoc->formatOutput = true;
    //Save and create path to gallery ID

    $galleryPath = $_SERVER['DOCUMENT_ROOT'] . "/data/gallery/" . $galleryID;

    //Set path
    if(is_dir($galleryPath)) {
        $xmlPath = $_SERVER['DOCUMENT_ROOT'] . '/data/gallery/' . $galleryID . '/xml/pageflipdata.xml';
        $xmlDoc->save($xmlPath);
    }
}//close while

Any suggestions on how I should go about doing this. There are about 2000 clientRef and each of the clientRef have 5-10 albums which can contain 15-30 images.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:53:10+00:00Added an answer on June 7, 2026 at 2:53 pm

    If timeout is the primary issue, you could just do it in smaller chunks and combine the xml later manually.

    If this needs to run regularly, you can use a similar process but run each ‘smaller chunk’ in a different request using ajax or something to wait for confirmation from all the small chunk scripts to run an xml combination script.

    Of course simply increasing the max_execution_time of PHP would be easier. If you don’t have access to this, you might be able to tweak something into working order by monitoring execution time and then calling set-time-limit to reset the timer again. I’ve never tried this, though, so just an idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Gurus, I have coded for my client a PHP script that performs some extensive
I have a webforms page that makes quite extensive use of AJAX. There are
I have quite big document in html format that generated from Microsoft Word. It
Hello StackOverflow community, I have run into a problem that quite frankly is baffling
Ok, I have a simple PHP script, that generates a thumbnail for a large
I have quite a complex piece of code (JQuery and HTML5 Web SQL) that
I have quite a few buttons in my application, they vary in sizes based
I have quite a problem concerning the use of relational database concepts in Delphi
I have quite a few situations where I have database structures similar to: TABLE
I have quite a lot of C++ legacy code modules from my colleagues, unfortunately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.