VPS

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)


Get Visitors Actual IP Address with LiteSpeed & Cloudflare

If you are using Cloudflare, your server will log Cloudflare IP address when visitors coming to your website. This problem can be solved by using mod_cloudflare for Apache server.

However, the method won’t work with LiteSpeed. Fortunately, LiteSpeed has a much simpler method to get the actual visitor’s IP address.

Use the following steps in order to obtain actual visitor’s IP address if you are using LiteSpeed & Cloudflare.

  1. Login to LiteSpeed Web Admin Panel
  2. Browse to Configuration → Server  General Settings
  3. Edit “Use Client IP in Header” to “Yes
  4. Save & Start LiteSpeed Gracefully