Solved

Timeout

Posted on 2001-09-14
1
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

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 how to implement server side field validation and display customized error messages to the client.
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

724 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