PHP

Fix “No data was received to import…” in phpMyAdmin with IIS

I have Windows 2008 R2 VPS & already installed IIS v7.5, PHP & MySQL.

I move some of my websites to this new VPS & try to import MySQL database via phpMyAdmin. I was greeted with following error.

No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See FAQ 1.16.

FAQ 1.16 does not help because it only says that my upload database size is too big. I only try to import 5kb database way below the limit.

Further digging reveal that the problem caused by the temporary directory PHP uses for uploads. By default this is C:\Windows\Temp, which is not writable for PHP.

To solve this,

1. Edit “php.ini” file & change

upload_tmp_dir="C:\Windows\temp"

to

upload_tmp_dir="C:\inetpub\temp"

2. Make sure to remove any other “upload_tmp_dir” settings.

3. Set permissions on “C:\inetpub\temp” so that IUSR and IIS_IUSRS have write permission.

4. Restart the web server (IIS)


How to Display GPS Coordinate in Listing Page of phpMyDirectory

If you are using phpMyDirectory and would like to display GPS Coordinate in listing page, this is the modification required.

To do this, 2 files have to be modified,

  1. listing.php -> located in the root of phpMyDirectory installation
  2. listing_default.tpl -> located in template directory

listing.php

Search following code,

$template_content->set('map',$map_output);

Add the following codes directly below

$template_content->set('latitude',$listing['latitude']);
$template_content->set('longitude',$listing['longitude']);

and save it.

listing_default.tpl

Search following code,

<?php echo $map; ?>

Add the following codes directly above it,

<h2>GPS Coordinate, Location and Map</h2>
<strong>Latitude : </strong><?php echo $latitude; ?><br />
<strong>Longitude : </strong><?php echo $longitude; ?><br /><br />

and save it.