Solved

Timeout

Posted on 2001-09-14
1
241 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now