Solved

Timeout

Posted on 2001-09-14
1
245 Views
Last Modified: 2006-11-17
Hi, I use the following code to restore a database file sql.sql and it works fine but when sql.sql file is large I got :

Fatal error: Maximum execution time of 30 seconds exceeded ...

My sql.sql file is about 15 MB is there a way to take over this problem notice that i don't have access to php.ini ??

restore.php script:
===================

<?
      $server= "localhost";
      $username="xxxx";
      $password="xxxx";
      $db="xxxx";

      $conn = mysql_connect ($server, $username, $password);
      mysql_select_db ($db, $conn);

      $file="sql.sql";
      $sql = join("", file($file));
                             
      $sql = split(";", $sql);
                               
       for($i=0;$i<count($sql);$i++)
           mysql_query($sql[$i],$conn);
?>


0
Comment
Question by:Zuhair070699
1 Comment
 
LVL 1

Accepted Solution

by:
olegtim earned 100 total points
ID: 6484260
well I guess your sql file is a database dump, if you have the shell access you can simply do it from there, just upload the file to some directory, than go into that directory and do:

mysql DATABASENAME -uUSERNAME -pPASSWORD < sql.sql

(no spaces between the option -u and username, same for -p and password)

If you have no shell access you can do it in php with exec() like this:

<?php
exec('mysql DATABASENAME -uUSERNAME -pPASSWORD < sql.sql');
?>

let me know if it helps
olegtim
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IP 10.0.1.2 / 255.0.0.0 61 56
Undefined Variable: loop_limit, Undefined Variable: number 3 18
Echo Multiple values from multiple records 19 45
check mysql insert 12 28
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question