?
Solved

Timeout

Posted on 2001-09-14
1
Medium Priority
?
248 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 400 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

770 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