Category Archives: WAMP Developer Server

How to Uninstall WampDeveloper

Uninstalling WampDeveloper is very easy, but it is not done through Windows’ Control Panel\Programs and Features interface.

To uninstall WampDeveloper:

1. Go into WampDeveloper’s Components Tab.

2. At the very bottom, locate and click the “Uninstall WampDeveloper” link.

3. Proceed by clicking “Run Uninstallation Tasks”, then afterwards, once it’s done, click “Continue” to close it.

4. Once it’s finished and closed, delete the remaining C:\WampDeveloper\ folder to clear everything out (changes made, websites, databases, etc) and to start with a clean state before installing again.

* If Windows won’t let you delete the WampDeveloper folder, then some files inside it are still in use, just reboot/restart the system, then try deleting the folder once more.

* WampDeveloper is entirely self-contained (in it’s folder), and the uninstallation process does not delete any files – just in case you have websites and databases to keep. The task of deleting WampDeveloper’s folder is left to the user.

If you are uninstalling due to issues right after installation, you should go over this information:

Enabling IonCube Loader in WAMP

IonCube Loader enables WAMP servers such as WampDeveloper Pro to run encoded and secured PHP files. These files are usually commercial (not free) PHP scripts and apps that have been secured against reverse-engineering and piracy – such as WHMCS, vBulletin, Blesta, KBPublisher, and extensions/plugins for Joomla, WordPress, ExpressionEngine, etc.

To enable the IonCube PHP Extension in WampDeveloper Pro:

1. Open file php.ini -
C:\WampDeveloper\Config\Php\php.ini

2. Near the end of php.ini, locate the IonCube section -

[Ioncube]
;zend_extension="C:\WampDeveloper\Components\Php\ext\ioncube_loader.dll"

3. Un-comment the load line for this extension (remove the ‘;’ character from the beginning of the line) -

zend_extension="C:\WampDeveloper\Components\Php\ext\ioncube_loader.dll"

4. Save file. Restart Apache.

Afterwards, IonCube will be loaded by PHP and you can verify this via phpinfo.php.

* Generally IonCube Loader should be loaded in php.ini before any of the other extra PHP Extensions.

* The latest IonCube Loader version can be downloaded from here http://www.ioncube.com/loaders.php, but it must match Apache’s + PHP’s compiler version (“VC11″ is Apache 2.4, “VC9″ is Apache 2.2, “VC6″ is Apache 2.0) and PHP run-type (“TS” is regular PHP / mod_php, “Non-TS” is PHP-FCGI). The newer versions can replace the older versions by simply copying-over …\Php\ext\ioncube_loader.dll.

IE Displaying Pages Differently Between Website on Local Host and Website on Live Server

If your website is rendering differently in IE when – hosted from a local development system (localhost, local network, etc) and the live server (hosting account), it’s because IE is…
A) Detecting that this website is coming from the Local Intranet Zone (vs. the Internet Zone).
B) And, in-turn, rendering the website in Compatibility View (usually in IE7 mode!).

IE does this because most intranet use is done in the Corporate and Enterprise setting, which is built around an enormous amount of internal legacy code, pages, and webapps. And backward compatibility is the #1 selling point for Microsoft in this market.

Setting IE’s Compatibility Mode

To clear out the above IE behavior:

IE Settings > Tools > Compatibility View Settings

Uncheck “Display intranet sites in Compatibility View”, and also uncheck (if set) “Display all websites in Compatibility View”.

Then in IE Dev Tools (press key: F12), make sure that “Browser Mode:” and “Document Mode:” are set to the latest version.

Setting Page’s Document Mode

In the page’s template and/or source code, add “X-UA-Compatible” META Tag to force:

  • Browser’s highest document mode:
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  • Full IE8 Standards Mode:
    <meta http-equiv="X-UA-Compatible" content="IE=8">
  • IE8 Quirks Mode if no valid DOCTYPE is defined:
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">

*This Meta Tag must be placed in the <header> section before any other tags.

Or you can set this server-side by sending a “X-UA-Compatible” Response Header:

<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    BrowserMatch MSIE ie
    Header set X-UA-Compatible "IE=edge" env=ie
    Header append Vary User-Agent
  </IfModule>
</IfModule>

The above code can be placed in the website’s VirtualHost file or an .htaccess file.

*The Meta Tag takes precedence and will override the Response Header (if both are present).

Further Reading

A guide to IE Compatibility View and X-UA-Compatible
What’s the difference if meta tag X-UA-Compatible exists or not?

Microsoft

X-UA-Compatibility Meta Tag and HTTP Response Header
Controlling default rendering
Specifying legacy document modes
Defining document compatibility

Installing PEAR For WAMP

Installing and setting up PEAR is very easy.

1. Create this folder if it does not already exist:
C:\WampDeveloper\Tools\PEAR

2. Download the latest version of PEAR’s installation file and save it into the above folder:
http://pear.php.net/go-pear.phar

3. Open the command line (WampDeveloper, System Tab, button: Command Line) and within run these commands:

cd \WampDeveloper\Tools\PEAR
php go-pear.phar

4. Select to install PEAR system-wide.

Notes

WampDeveloper already includes path "C:\WampDeveloper\Tools\PEAR" in PHP’s "include_path" setting (php.ini).

PEAR Installation Guide

List Of PEAR Packages

Enabling WampDeveloper’s PHP OPcache (OPcode Cache)

To enable the PHP’s OPcode cache extension “php_opcache.dll”:

1. Open PHP’s configuration file php.ini (Reliability Tab, click button: php.ini).

2. Near the bottom of the file find section “[Zend OPcache]“, and uncomment that section (remove the ‘;’ from each line). Be careful not to uncomment the plain-text lines (the real comments that explain things) or Apache might not start.

This should already be set to “1″, which enables OPcache globally for all websites (…the other option is to only enable it for specific websites via their VirtualHost files):
opcache.enable=1

3. Save file (php.ini). Close and open WampDeveloper again. Restart Apache.

Notes

* There is a minor bug in the current release of Apache and/or PHP versions that makes phpMyAdmin eventually crash Apache while the PHP OPcode cache is enabled, unless you implement the fix shown here:
http://www.devside.net/wamp-server/wampdeveloper-5-known-issues-and-solutions

Edit file:
C:\WampDeveloper\Config\Apache\extra\wampd-phpmyadmin.conf

Comment out line (add ‘#’ in front):
php_admin_flag opcache.enable Off

* If you update your PHP scripts while the PHP OPcode cache is enabled, this configuration line in the “[Zend OPcache]” section will cause the previous results to remain for 60 seconds before your changes are displayed (which confuses a lot of developers when they don’t see the changes immediately):
opcache.revalidate_freq=60

* OPcache must be enabled globally (opcache.enable=1) when using PHP-FCGI, as in this case, it’s not possible to set this value via a website’s VirtualHost.

Setting Up An FTP Connection To WAMP

To set up FTP access to your websites, you have to -

1. Install your choice of an FTP Server, such as FileZilla (a popular one), on the same system that the WAMP server is on.

2. Using the FTP Server:

A) Create an FTP user account with full read and write permission granted on your website’s \webroot (DocumentRoot) folder.
Example: C:\WampDeveloper\Websites\www.example.com\webroot\

B) And set that folder as the FTP user’s home-folder.

Then to take care of everything else -

1. Port-forward the FTP port in the Router to the LAN IP address of the server (if you are behind a Router).

2. Open the FTP port (for incoming connections) in Windows’ Firewall application.

The FTP port is 21.

The remote FTP user would then login on the WAMP server’s IP address (Public IP) or website’s domain-name (if the domain is registered and reachable) using his username + password credentials, and will have access to the specified home-folder.

* Everything related to FTP would be done via the FTP Server, and not the WAMP server.

* WinSCP is a good FTP client that can be used to connect to the FTP server.

Using Gmail and MSMTP To Send Mail From PHP

1. Enabled IMAP access under your Gmail account, to be able to connect to Gmail via something other than its web interface:

Settings - Forwarding and POP/IMAP - IMAP Access - Enable IMAP - Save Changes

gmail-imap-access

2. Set PHP to use MSMTP as “sendmail”:

Edit file php.ini (C:\WampDeveloper\Config\Php\php.ini)

Disable mail()’s default use of a local mail server.

;SMTP = localhost
;smtp_port = 25

* Comment the above lines for SMTP and smtp_port by using the “;” character.

Enable mail()’s use of MSMTP.

sendmail_path = "C:/WampDeveloper/Tools/msmtp/msmtp.exe -d -C C:/WampDeveloper/Tools/msmtp/msmtprc.ini -t --read-envelope-from"

mail.log = "C:/WampDeveloper/Logs/Php/maillog.txt"

* Uncomment the above lines by removing the “;” character. And make sure to update the paths to the correct drive letter.

3. Define your Gmail account information for MSMTP to use (using Gmail’s outgoing mail settings):

Edit file msmtprc.ini (C:\WampDeveloper\Tools\msmtp\msmtprc.ini)

# Default values for all accounts
defaults
tls_certcheck off
logfile C:/WampDeveloper/Tools/msmtp/msmtplog.txt

* Make sure to update the logfile path to the correct drive letter.

account Gmail
host smtp.gmail.com
port 587
auth on
tls on
from my.email@gmail.com
user my.email@gmail.com
password mypassword

* Update the above lines with your email address and password.

4. Send a test email:

Create file C:\WampDeveloper\Websites\www.example.com\webroot\send-email.php

Set the proper “$from” and “$to” email addresses.

<?php
  $from    = 'my.email@gmail.com';
  $to      = 'someone.else@somewhere.else';

  $subject = 'Test Subject';
  $message = 'Hello. Testing email.';
  $headers =
    'From: ' . $from . "\r\n" .
    'Reply-To: ' . $from . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

  if(mail($to, $subject, $message, $headers))
    echo 'Mail function returned successfully. Mail has probably been sent.';
  else
    echo 'Error! Mail function failed. Mail NOT sent.';
?>

* Make sure that your “From:” email address matches the email address defined for Gmail in msmtprc.ini. You cannot use another email address (Gmail will reject it).

Access URL http://www.example.com/send-email.php

Then check your Gmail’s Sent folder, and your receiving account’s Inbox and Spam folder.

5. Debugging MSMTP:

If you do not receive your test email, and your Gmail account does not have a copy of the email in its Sent folder, check MSMTP’s log file for clues (msmtplog.txt).

You can also test sending a basic email directly from the command line (to bypass PHP) to see if MSMTP is working itself (it will output debug info)…

echo Subject: Testing Email. | C:\WampDeveloper\Tools\msmtp\msmtp --debug --file=C:/WampDeveloper/Tools/msmtp/msmtprc.ini --logfile=C:/WampDeveloper/Tools/msmtp/msmtplog.txt --from=my.email@gmail.com -t someone.else@somewhere.else

* Update the above paths, and the “from” (my.email@gmail.com) and “to” (someone.else@somewhere.else) email addresses. This email will only have a subject line, it will not have a body due to the limitations of the command line.

6. Help:

MSMTP Docs
PHP Mail Function
Problems sending mail with POP or IMAP

Website Only Shows Text Content With All Graphics Missing

My site look perfect from localhost, but not from the internet. Why can’t I see styles and pictures on my website?

The simple answer is that all your generated links (in the HTML source of the page) are still probably using “localhost”…

If you load your website in your Browser (Chrome, IE, Firefox) from outside, right click on the page, and select ‘View Page Source’, you’ll see that all the links to the CSS and Graphic content (images) are either:

  1. Of the form http://localhost/ or http://127.0.0.1/
  2. Or using a domain-name that is made up or does not have proper global DNS set up.

None of these locations and URLs are reachable from outside. They are only reachable from the server (the local system).

You have to use a Domain Name for the website that is not localhost, a LAN IP, etc. That Domain Name should also resolve to the public IP address of the server, and not a local or LAN IP.

This could also be a webapp issue – for example, with WordPress originally installed for localhost, you’ll need to go into WordPress Setting, General Tab, and update/change the “wordpress address” and “site address” to a address other than “localhost” (an address that can be reached from outside).

* When you test your website again from outside, make sure to hard-refresh the page (in your Browser) by pressing Ctrl-F5 so everything is reloaded (so you don’t get cached pages and old results).

How to Transfer a Local MySQL Database to Another Server

These instructions will show you how to export a single database from MySQL into an SQL file, that you can move/copy to the remote Host, and import it into that Host’s MySQL server. The local and remote Hosts can be either Windows or Linux (it will work identically).

Execute these commands into the command-line (Windows) or shell (Linux).

On Local Host

mysqldump --user=root --password db.name > db.name.sql

This will create and populate file \<working-directory-path>\db.name.sql with database named “db.name”.

On Remote Host

mysqladmin --user=root --password drop db.name
mysqladmin --user=root --password create db.name
mysql -u root -p db.name < \path\to\db.name.sql

This will delete and create database named “db.name”, and then will populate that database with data from SQL file \path\to\db.name.sql.

Notes

* Leave the “--password” and “-p” switch out if MySQL’s root password is not set. Otherwise, the password will be prompted for when you press Enter.

* Be careful copy/pasting character: ‘-’. It can be inadvertently changed to a special Unicode dash character (instead of the ASCII hyphen-minus) that’s indistinguishable, which will not work.

* Aside from the command-line, all this can also be done from phpMyAdmin.

* Also, this can be done automatically by saving the export and import commands into a BAT or SH file on each system, so you never have to redo/retype them, just click or execute one file.

* To create a user with permissions set to a database, execute:

mysql -u root -p
GRANT ALL PRIVILEGES ON `db.name`.* TO 'db.username'@'db.hostname' IDENTIFIED BY 'db.password';
exit

* WinSCP is a good FTP client if you need to transfer the files.

Hosting Apache and WAMP Websites on Azure Cloud

After installing Apache, or a WAMP server such as WampDeveloper Pro, in a Windows VM on Azure Cloud, you’ll need to connect that VM to port 80 and also open internet access to Apache.

Create Endpoints for Port 80 and 443

Azure needs to have its “port endpoints” set up to be able to forward incoming port 80 and 443 traffic to the right VM (and the right port in the VM).

Create new endpoints from Public:80 to Private:80 (and the same for port 443). Don’t select/check-mark ‘Create load-balancing set’, nor ‘Enable direct server return’, unless you are running multiple VMs and want the traffic to be split between them for these ports.

Virtual Machine > Endpoint > Add endpoint > Next > name:http, protocol:tcp, public port:80, private port:80 > click Complete

How to Set Up Endpoints to a Virtual Machine

Configure Windows Firewall To Open Port 80 and 443

Windows Firewall blocks, by default, incoming port 80 (HTTP) and 443 (HTTPS) requests, for Protocol TCP and UDP. You’ll need to create Inbound Rules to open these ports.

Note that:

  • If IIS was installed previously, the existing port 80 and 443 rules might only be in effect for IIS. Delete them and create new rules for general port 80 and 443 use.
  • Check for any blocking rules automatically created for the Apache httpd.exe program, they will be named as such (Apache HTTP Server).
  • Every time you update/change Apache versions, the Windows Firewall will attempt to create a new blocking rule for it.

Clear Access Control List Rules

Select port 80 and 443 Endpoints and click ‘Manage ACL’. Delete any rules present (you do not need them for a publicly accessible website).

Other

* It might take 10 minutes for endpoint changes to take effect in the system.

* Before installing or running Apache on Azure, make sure that IIS is uninstalled, or at least that its Service is stopped and its Startup Type changed from “Automatic” to “Manual” or “Disabled”. Apache and IIS are both configured (by default) to bind-to/listen-on ports 80 and 443 on all IPs, and unless they are bound to different IPs or on different ports, they will not be able to run at the same time (side-by-side).