Tag Archives: PHP

phpMyAdmin: Script timeout passed, if you want to finish import, please resubmit same file and import will resume. (Solved)

Open the file  xampp\php\php.ini


Change to:
post_max_size = 500M
upload_max_filesize = 500M
max_execution_time = 300
max_input_time = 500
memory_limit = 1000M

Reboot MySQL and Apache, on the “import” window, it may not show 500M in the Maximum place, I can’t remember clearly. But when I re-import the file, it still shows “Script timeout passed, if you want to finish import, please resubmit same file and import will resume.”

Then I go to xampp\phpMyAdmin\config.inc.php, add this line
$cfg[‘ExecTimeLimit’] = 0;

It’s said it can make the limit to infinity.

Then I reboot MySQL and Apache and re-import, it shows “MySQL has gone away”, I increase the limit in the configuration file of MySQL, finial I succeed.

How to set up a php cron job on godaddy.com (with command sample)

The command:
/usr/local/bin/php /home/myaccount/public_html/folder_name/mycron.php

If you don’t know the path, you can use “dirname(__FILE__)” to get it.

If you want to test it, set time to “every minute”. If it output something on the webpage: mycron.php, like echo, “this will be shown on the webpage”; , it will send you an email. If no output to the webpage, no email.

Static Keyword and Scope Resolution Operator

Scope Resolution Operator (::)

The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon

“As of PHP 5.3.0, it’s possible to reference the class using a variable. The variable’s value can not be a keyword (e.g. self, parent and static). ”

Static Keyword

arrow operator ->

Upload files without reloading the webpage and with process meter including demo, codes for download

under license GNU GPL.Smile

Demo: click here

download: click here

manual: click here

It uses php, javascript. The explaination in details is as below:

The basic idea is to target the action of the form to a hidden iframe. When the form is submitted, theoutcome is shown in iframe. Since it’s hidden, the user can’t see it. This function is realized by the”target” property of the form.

The code on the webpage:

<form enctype=”multipart/form-data” id=”upload_files_form” target=”upload_target” method=”post” action=”upload.php”>
   <input type=”hidden” name=”MAX_FILE_SIZE” value=”10000000″>  
   <input name=”upfile[]” type=”file”  />
   <button name=”submit” type=”submit”>click here to upload files</button> 
   <iframe id=”upload_target” name=”upload_target” style=” display:none;” ></iframe>

The code on upload.php:
//here ud_pics.php includes a class to upload files
$ud = new UD_PICS();  
$upload = $ud->upload_pics(”,”);

Add the code as below on upload.php. When the code above is finished, the javascript function stopUpload() on the mainpage will be called. The value of $outcome will be returned to the function stopUpload(). Here the value of $outcome can be 0 or 1. If it is a string, it will have error. So if more information about uploaded files, we need to get the content of iframe now.  

<script language=”javascript” type=”text/javascript”>
  window.top.window.stopUpload(<?php echo $outcome; ?>);

Related link:
How to get the content from < iframe> with javascript