Category Archives: WAMP Developer Server

Moving Websites and Databases Between 2 WAMP Installs

This assumes you have the same WampDeveloper versions (ex: WampDeveloper 5.0) installed on each system, running the same MySQL branch (ex: MySQL 5.6), and that each WampDeveloper instance is installed on the same path (ex: C:\WampDeveloper).

First, make sure the receiving WampDeveloper installation has the same websites already created via the Websites Tab – so all the VirtualHosts, website folders, and other configuration files exist.

Then stop the Apache and MySQL Services on both systems.

Transferring Websites

Transfer (zip up and copy) to the other system the Websites folder. Select to overwrite everything, if prompted.
C:\WampDeveloper\Websites\

As an alternative, you can instead only move a specific website by transferring sub-folder:
C:\WampDeveloper\Websites\Websites\domain.name\

Transfer Database

Delete the other system’s Database folder. Replace it completely (replace it, don’t copy-over to overwrite files).
C:\WampDeveloper\Database

MySQL Issues

If MySQL does not start/run after the \Database folder is replaced, and both machines are using the same MySQL version…

It’s possible that your ZIP program, FTP program, etc, (whatever you are using to package + transfer the files), or its options, does not preserve this NTFS Junction-Point folder link:
Database\mysql-data –> Database\mysql-data-56

You can re-create it (after transferring the \Database folder) by:

1. Deleting folder: Database\mysql-data

2. Opening the command-line w/administrative-permissions (System Tab button) and executing this command (*all on one line):
mklink /j D:\WampDeveloper\Database\mysql-data D:\WampDeveloper\Database\mysql-data-56

Note that the above example is for WampDeveloper v5.0 using MySQL 5.6.
For MySQL 5.5, the folder is: Database\mysql-data-55
For MySQL 5.1, the folder is: Database\mysql-data-51

And under WampDeveloper v4.x the Database folder is “as-is” (it does not have specific version sub-folders, nor NTFS Junction-Point links).

If this is not the issue, open this log file to see MySQL’s error messages:
C:\WampDeveloper\Logs\Mysql\errorlog.txt

VirtualHosts and other Website Specific Configuration Files

If you’ve made custom changes to the websites’ VirtualHost files, they exist in this folder and can be transferred:
C:\WampDeveloper\Vhosts\

Files:
domain.name.http.vh.conf
domain.name.ssl.vh.conf

If you’ve made custom changes to the websites’ AWStats files, they exist in this folder and can be transferred:
C:\WampDeveloper\Tools\awstats\wwwroot\cgi-bin

File:
awstats.domain.name.conf

Custom DocumentRoot Locations

WampDeveloper expects all websites to be contained under folder C:\WampDeveloper\Websites\ (and it’s best to leave this as-is), but you can work around this by using NTFS “Junction Points” to make a link between an outside folder and either the website’s entire containing folder or the website’s \webroot (DocumentRoot) folder.

First, create a website via WampDeveloper, it will create a website DocumentRoot folder such as:
C:\WampDeveloper\Websites\www.example.com\webroot

Then create an NTFS “Junction Point” from the website’s webroot folder to the real location…

1. Delete (or move to new location) the website’s existing DocumentRoot folder:
C:\WampDeveloper\Websites\www.example.com\webroot

2. Then from the command line (WampDeveloper’s System Tab, Command Line button) execute (all on one line):
mklink /j C:\WampDeveloper\Websites\www.example.com\webroot C:\Users\YourName\Documents\Web\ProjectName\WebsiteRoot

*Note that C:\Users\YourName\Documents\Web\ProjectName\WebsiteRoot has to already exist.

This way you’ll have your real C:\Users\YourName\Documents\Web\ProjectName\WebsiteRoot folder (where the files reside) and a link to that folder from C:\WampDeveloper\Websites\www.example.com\webroot (which is what WampDeveloper will use).

Notes -

“Junction Points” only work between local drives of the system and OS (between local volumes), and will not link to networked drives or remote shares.

It is also not usually possible to directly link the folders of websites, nor the database folder, to a NAS device.

To use network shares, you would need to change Apache’s account from “LocalSystem” to an account that has network share access. Under Windows, while “LocalSystem” can access TCP/IP, it does not have permissions to access network shares.

Non-local file system access will significantly slow down Apache.

Upgrading WampDeveloper Versions

The cleanest and best way to do an upgrade between minor (v4.2.0.1 to v4.2.0.3) and major versions (v4.1 to v4.2 to v5.0) of WampDeveloper is to perform a clean-reinstall. Followed by a website + database transfer procedure (if needed, to maintain all websites and databases)…

Clean Reinstall of WampDeveloper

1. Click the Uninstall link at bottom of Components Tab. The uninstallation process will not delete any files or databases.

2. Rename folder C:\WampDeveloper to C:\WampDeveloper.old. If Windows does not allow the folder to be renamed, then some files are still in-use or open, reboot your system to close everything.

3. Install new version of WampDeveloper to the previous location (ex: C:\WampDeveloper). Then reboot.

4. Use Websites Tab to re-create your websites so all new and updated VirtualHosts, other configuration files, and website folders are created.

5. For the websites + databases transfer processes, stop Apache and MySQL…

Transfer Websites

If you need to preserve your previous websites…

1. Copy from C:\WampDeveloper.old your \Websites folder over C:\WampDeveloper\Websites (copy-over, overwrite all).

Transfer MySQL Database Files

If you need to preserve your previous databases…

Note that:

WampDeveloper 4.1 used MySQL 5.1 with database location: \WampDeveloper\Database\

WampDeveloper 4.2 used MySQL 5.5 with database location: \WampDeveloper\Database\

WampDeveloper 5.0 uses MySQL 5.6 by default, but can also switch to using MySQL 5.5 and 5.1; with each major MySQL branch maintaining its own database files (because the data format/schema of the files is different for each MySQL branch):
MySQL 5.6 as \WampDeveloper\Database\mysql-data-56\
MySQL 5.5 as \WampDeveloper\Database\mysql-data-55\
MySQL 5.1 as \WampDeveloper\Database\mysql-data-51\

If you are upgrading the WampDeveloper version (v4.2 to v5.0)

1. Place the previous database files in the new location…

Ex: Delete \WampDeveloper\Database\mysql-data-56\ and copy + rename \WampDeveloper.old\Database\ as \WampDeveloper\Database\mysql-data-56\

2. The database files, when moved under a newer MySQL branch, have to be updated for that branch by running (from System Tab command-line button):
mysql_upgrade.exe

If you are re-installing the same WampDeveloper branch (v4.2 to v4.2)

1. Move back in your \Database folder (replace in entirety, don’t copy-over). Nothing else needs to be done as your MySQL branch remains the same.

If you are upgrading from WampDeveloper v4.1 to v4.2

1. Download http://www.devside.net/download/trial/WampDeveloper-4.2.0.3.zip

2. Replace the \Database folder and run from the command-line:
mysql_upgrade.exe

3. Due to a my.ini configuration change (for logfile size) between WampDeveloper v4.1 and v4.2 (and the way MySQL 5.5 behaves), MySQL won’t start until files C:\WampDeveloper\Database\ib_logfile0, and ib_logfile1 (if it exists) are deleted.

4. Re-install phpMyAdmin’s database (because phpMyAdmin was upgraded from v3.5 to v4.0).
Open the command-line (via System Tab), and execute the following commands:
mysql -u root -p
DROP DATABASE phpmyadmin
SOURCE C:/WampDeveloper/Tools/phpMyAdmin/examples/create_tables.sql
exit

(*if you have not set a password for MySQL account: root, leave the ‘-p’ part out)
(*make sure to update the path in the SOURCE command if WampDeveloper was installed on a different drive; not on drive C:)

Migrate Custom Changes

If you had any custom changes made to the Apache, PHP, or MySQL configurations, the VirtualHost files, AWStats, etc, those changes would need to be re-implemented.

A quick way to see the difference between two configuration files (previous vs. new), or between all files in two directories (ex: between WD 4.1 and WD 4.2 \WampDeveloper\Config\ folders), is to use a tool such as WinMerge or WinDiff.

Howto Update WampDeveloper’s Apache PHP MySQL Versions

WampDeveloper can switch between all provided versions of Apache, PHP, and MySQL automatically, while retaining all websites, configurations, databases, etc.

To switch or update to the latest provided PHP version…

1. Go into the Components Tab, PHP sub-tab.

2. Click on the download link for the version of PHP you want to use:

For example: php-5.3.28.0-r1-win32-vc9-standard.zip

(*note that there are standard and fcgi versions of PHP provided)

3. After downloading it, open folder C:\WampDeveloper\Versions\Php\ and extract the contents of the zip directly into this folder.

Important -

If you’ve downloaded and unzipped the above PHP version (5.3.28) correctly and into the proper Versions folder, this file path should now be valid and exact…
C:\WampDeveloper\Versions\Php\php-5.3.28.0-r1-win32-vc9-standard\php.exe

Most of the issues happen here: it gets unzipped into the wrong folder, or into an extra sub-folder, or just gets all it’s inner files (zip-file\php-***\files) extracted out into …Versions\Php\.

4. Then check-mark the above PHP version in Components Tab. If you can’t check-mark it, it’s been unzipped into the wrong place. Otherwise, try restarting the WampDeveloper application.

5. Click “Update To Selected”. WampDeveloper will do the rest. All your websites, the MySQL Database, configurations, and everything else, will remain as-is.

The User-Interface will switch to the new versions in about 10 seconds.

The process is exactly the same for all other components (Apache and MySQL).

Building Apache 2.2 on Windows

Building Apache 2.2 on/for Windows

Step by step instructions for building Apache 2.2.x with mod_deflate and mod_ssl on Windows using VS.NET 2008 (VC9 to match official PHP 5.3 builds).

Downloads

1. Download Apache’s httpd-2.2.26 source code and extract as C:\build\httpd-2.2.26

2. Download zlib-1.2.8 source code and openssl-0.9.8y source code and extract into httpd-2.2.26\srclib

3. Rename httpd-2.2.26\srclib\zlib-1.2.8\ and httpd-2.2.26\srclib\openssl-0.9.8y\ to zlib\ and openssl\ (remove the version info from the directory name).

4. Download apr-iconv-1.2.1-win32-src-r2.zip source code and extract into httpd-2.2.26\srclib

5. Rename httpd-2.2.26\srclib\apr-iconv-1.2.1\ to apr-iconv\ (remove the version info from the directory name).

Build Environment

The build requires the following tools to be installed, and to be in your system’s %PATH% (environmental variable):

1. VS.NET 2008 and Windows SDK 6.1
2. perl – C:\build\Perl
3. nasm – C:\build\nasm
4. Specific GnuWin32 tools: awk (“gawk” renamed to “awk”), bison, flex, sed – C:\build\gnuwin32

Build Apache

1. Open Windows SDK 6.1 cmd.exe (*using 6.1 rather than 7.1 to match official PHP build)
2. SetEnv.cmd /Release /XP /X86
3. “C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat” (*not needed since we are using the SDK’s environment cmd.exe window)
4. set path=%path%;C:\build\gnuwin32;C:\build\nasm
5. + set path variable to include location to perl.exe

6. CD C:\build\httpd-2.2.26
7. perl srclib\apr\build\lineends.pl (convert line-endings from Linux to Windows style)
8. perl srclib\apr\build\cvtdsp.pl -2005 (convert DSP files from VC6 to VS2005 format)
9. Open Apache.dsw with VS.NET 2008 to convert ALL to current format (from 2005 to 2008) and to create some *.vcproj files. Then File > Save All. Exit.

10. CD C:\build\httpd-2.2.26\srclib\zlib

11. (*Note – taken from contrib\masmx86\bld_ml32.bat)
(*Note – builds ASM implementations of the functions longest_match() and inflate_fast())
ml /coff /Zi /c /Flmatch686.lst contrib\masmx86\match686.asm
ml /coff /Zi /c /Flinffas32.lst contrib\masmx86\inffas32.asm

12. (*Note – _CRT_SECURE_NO_DEPRECATE and /wd4996 will disable deprecation warnings)
NMAKE -f win32\Makefile.msc LOC=”-D_CRT_SECURE_NO_DEPRECATE /wd4996 -DASMV -DASMINF” OBJA=”match686.obj inffas32.obj”
MT -manifest zlib1.dll.manifest -outputresource:zlib1.dll;2

13. CD C:\build\httpd-2.2.26\srclib\openssl

14. (*Note – IDEA cipher in OpenSSL is patented for commercial use)
(*Note – NASM is preferred over MASM for building OpenSSL)
PERL Configure VC-WIN32 –openssldir=/Wamp/Apache/bin enable-camellia disable-idea
ms\do_nasm
NMAKE -f ms\ntdll.mak

15. CD C:\build\httpd-2.2.26

16. NMAKE -f Makefile.win INSTDIR=C:\Wamp\Apache installr
(*make sure this folder does not exist – that nothing is not already installed there)

17. CD C:\WampDeveloper\Components

18. (*Note – to preserve all PDB files into another folder – 300+ files)
C:\Wamp>xcopy /S Apache\*.pdb Apache-2.2.26-pdb-files\

19. CD C:\Wamp\Apache

20. del /s *.pdb

21. move conf\openssl.cnf bin\

mod_fcgid.so

If you are going to run PHP via FCGI (NTS releases of PHP), build mod_fcgid against the above installed Apache package (against C:\Wamp\Apache; not C:\build\httpd-2.2.26).

1. set APACHE2_HOME=C:/Wamp/Apache
2. devenv /useenv mod_fcgid.dsw (*to generate VC6 to VS.NET sln file)
3. Convert ALL. Then File > Save All.
4. Build > Configuration Manager. Solution – Release. Build Solution.
5. Copy C:\build\mod_fcgid-2.3.7\modules\fcgid\Release\mod_fcgid.so into C:\Wamp\Apache\modules\ dir.
6. Copy C:\build\mod_fcgid-2.3.7\modules\fcgid\Release\mod_fcgid.pdb into C:\Wamp\Apache-2.2.26-pdb-files\modules\ dir.

Extra Database Drivers for Apache

http://wiki.apache.org/httpd/Win32VC9Build

The ODBC driver is included by default on Windows. To add additional database drivers, first ensure that your LIB and INCLUDE environment variables include the directories which contain the .lib and .h files for your database. Add a DBD_LIST to your NMAKE command, which should be be set to a space-separated list of the desired drivers. For example - if MySQL is in C:\MySQL and SQLite is in C:\SQLite: 

SET INCLUDE=%INCLUDE%;C:\MySQL\include;C:\SQLite
SET LIB=%LIB%;C:\MySQL\lib\opt;C:\SQLite
NMAKE -f Makefile.win  INSTDIR=C:\Wamp\Apache DBD_LIST="odbc mysql sqlite3"  installr

Unlock and Unblock the Windows Hosts File

Some anti-virus, anti-sypware/malware, and firewall software locks the Windows Hosts file so no one can edit it (by maintaining an open file-handle with no write share permissions on this file).

The file is -
C:\Windows\System32\drivers\etc\hosts

The most common Hosts file locker is SpyBot Search & Destroy. Others can be: ZoneAlarm, SpywareBlaster, Ad-Aware, WinPartol, HostsMan, etc.

Try to locate the application(s) that are responsible for this, and turn off the Hosts file lock in their settings (or uninstall/remove the application).

Unlocking the Windows Hosts File

Spybot S&D

With the Advanced Mode active
Tools section
IE Tweaks section
Uncheck: "Lock hosts file as protection against hijackers"

*you might need to start Spybot by right-clicking on it, and selecting ‘Run as admin’

ZoneAlarm

Firewall - Main - Advanced Button - Advanced Settings
Uncheck: "Lock Host File"
Reboot.

*you might also need to disable or configure ZoneAlarm’s OSFirewall

Other Applications

There are free tools you can use to find out who/what is locking this file. They will show you which process is maintaining the lock, and you can infer by the process’s name/path what the application is. Then open the application and go through the application’s settings.

Unlocker

Lock Hunter

Windows Sysinternals Process Explorer

Exclude Hosts File From Scans

Aside from unlocking the Hosts file, you’ll also need to make sure changes to this file are not marked as malicious and then undone – by excluding the Hosts file location from scanning.

Windows Defender & Security Esentials

On Windows 8, open Windows Defender. On Windows 7 and lower, open Windows Security Esentials.

Settings - Excluded files and locations
File locations: (type in...)
C:\Windows\System32\drivers\etc\;
Click Add, and then Save changes

Kaspersky

Settings - Threats & Exclusions - Exclusions - Settings
Add - Select file or Folder:
C:\Windows\System32\drivers\etc\

Notes

1. If you are unable to see this file, change Folder View options to: show hidden files and folders, show known file extensions, and NOT hide protected files.

2. The true HOSTS file path (under all Windows versions) is defined in this Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath

3. Howto reset the Hosts file to it’s original default state.

WAMP is Running Very Slow

How to make your WAMP run lightning fast again.

These steps to speed up your Apache, PHP, and MySQL installation on Windows will work for any WAMP installation, including WAMP Server and XAMPP. But some of the directory and file paths used here are specific to WampDeveloper (just substitute in the paths of your environment).

Windows

Windows Hosts file

Edit the Windows Hosts file and remove the localhost to IPv6 loopback (::1) resolve/mapping.

Edit file -
C:\Windows\System32\drivers\etc\hosts

Comment out the line by adding a ‘#’ in front:

# ::1 localhost

If “localhost” gets resolved to IP address “::1″, the request (not able to find an IPv6 listening socket) might still get routed back to IP address 127.0.0.1 (via timeout, fall-back, or some other mechanism), causing unnessasary delays for connections.

Make sure that “localhost” is correctly mapped to the IPv4 looback address “127.0.0.1″ (…that this line is not commented out):

127.0.0.1 localhost

*The Windows Hosts file is usually set read-only, and requires Administrative permissions to edit. Some applications (SpyBot, ZoneAlarm, etc) can maintain an edit lock on this file, and Microsoft Defender and/or Security Essentials sometimes detects changes to this file that it thinks are malicious, and changes this file back to its original state.

IPv6

Either unbind IPv6 from your network adapter (NIC card), or completely disable IPv6 on your system.

Problems with Windows and IPv6 have been known to add an additional half a second on the initial load-time of each request.

http://www.techunboxed.com/2012/08/how-to-disable-ipv6-in-windows-8.html

*Since IPv6 can be important to Windows, if this change does not resolve any issues (does not help to speed up WAMP), you should undo it.

Firewall and Anti-Virus software

Some Firewall and anti-virus software have been known to significantly slow down Apache and MySQL (such as Bitdefender, Avast, NOD32, Zone Alarm).

Try disabling them to see if it makes a difference (including the native Windows Firewall, Defender, and Security Essentials applications).

If it does, open their settings, and add the httpd.exe and mysqld.exe paths to the list of excluded programs that should not be interfered with.

C:\WampDeveloper\Versions\Apache\apache-2.2.25.0-r1-win32-vc9-standard\bin\httpd.exe
C:\WampDeveloper\Versions\Mysql\mysql-5.5.34.0-r1-win32-vcX-standard\bin\mysqld.exe

*You’ll need to do this for each version of Apache and MySQL that you use.

Also exclude the MySQL Database directory from any checks.

C:\WampDeveloper\Database

And possibly WAMP’s Temporary directory from any checks.

C:\WampDeveloper\Temp

Power Plan

Change Windows’ Power Plan (also called Power Options, in Control Panel) from the default of “Balanced” (or “Power Saver”) to “High Performance”. “Balanced” restricts CPU Scaling. This can increase performance 50%.

Local Issues

TCP/IP

Reset Winsock and TCP/IP back to their original state. Then reboot.

netsh winsock reset
netsh int ip reset c:\resetlog.txt

(*run from an admin level command-line; right-click cmd.exe, select ‘run as admin’)

Other software can attach filters to Winsock, and change the TCP/IP parameters, which causes Apache to stop responding to requests (slow page load, half page load, etc).

DNS

Make sure your system is not using old, invalid, non-working, and slow DNS Servers.

ipconfig /all

Wireless LAN adapter Wireless Network Connection:
   DHCP Server . . . . . . . . . . . : 192.168.1.1
   DNS Servers . . . . . . . . . . . : 8.8.8.8
                                       8.8.4.4
                                       209.244.0.3

The above should list the DNS Servers assigned to you by your ISP (via DHCP), or display a list of public DNS Servers that are set via your Router or OS settings.

Flush Windows DNS Cache:

ipconfig /flushdns

Your Browser

Slow response times for Chrome, Firefox, and IE can be indicative of:

A. Bad Proxy settings that are timing out -

Bypass proxy server for local addresses by creating Exceptions for your domain-names, and IP address 127.0.0.1.

B. Different Plugins, and Phishing and Malware protection settings -

Check your Browser’s active plugins, try disabling them. Check protection settings, exclude your domain-names.

C. Stale cached results -

Clear your Browser’s Cache. Also run Window’s Disk Cleanup.

Clear Your WAMP Log Files

Apache maintains website access and error logs that can grow in size very quickly. PHP also has similar logs (if enabled via configuration).

C:\WampDeveloper\Logs
C:\WampDeveloper\Temp

Once Apache log files grow in size to above several 100MB, performance issues can arise.

Also the Temp folder holds lots of session and temporary data files that don’t get properly cleaned up, which causes it’s own issues.

You can clear out the Log and Temp files like this -

Make sure Apache and MySQL are not running.

Open the command-line (run: cmd.exe).

Delete all the websites log files -

del /S C:\WampDeveloper\Logs\*log.txt

Delete all the temporary files -

del /S C:\WampDeveloper\Temp\*

Since this is a pure wildcard filename delete (*), it will ask you if you want to delete all the files each time it finds a new sub-directory… As it prompts you, press the ‘y’ or ‘Y’ key, then press the ‘Enter’ key; or add in the /Q switch (del /S /Q …) to tell it not to prompt you at all.

The above will delete all the log files and all the temp files, within all the sub-directories. Make sure you do this carefully (that you are using the right paths)!

If you do this manually, make sure to never delete the directories and sub-directories, just the files in them.

Apache

BufferedLogs

Turn log buffering On. This will cause Apache to buffer logs for multiple requests instead of writing them out individually to the log file – and improve disk I/O on a heavily accessed web server.

BufferedLogs On

MaxMemFree

Set the maximum number of free memory that every Apache thread is allowed to hold without attempting to give it back to the OS. Setting this value to 2048 KB (2MB) might prevent the Apache process from growing too large, as this will typically restrict its process max size to threads * MaxMemFree.

MaxMemFree 2048

ThreadsPerChild

Decrease the default amount of Apache Worker threads that the Apache process creates on startup to handle concurrent requests. Each Worker thread takes up system resources. The default number of 64-150 Worker threads under most WAMPs is too high.

ThreadsPerChild 32
ThreadLimit 32

EnableMMAP and EnableSendfile

Make sure EnableMMAP and EnableSendfile are not turned Off (they are On by default) as they use the OS’s abilities to speed up file access and delivery.

EnableMMAP On
EnableSendfile On

AcceptEx()

Make sure Win32DisableAcceptEx is not present in the configuration as it disables a faster way of accepting network connections on Windows (instead of AcceptEx() it uses accept()).

Win32DisableAcceptEx

*Under Apache 2.4, the function of Win32DisableAcceptEx has been replaced with the folowing configuration using the AcceptFilter directive:

AcceptFilter http none
AcceptFilter https none

*Warning when using WAMP Apache 2.4 and IE9+. For some reason IE9+ requests (IE9 is the minimum version tested, so it could be an issue with IE8 too) will break under Apache 2.4 (but not under Apache 2.2). In my case, the first request from IE will usually not start nor complete, though subsequent requests (but only when performed within a 3 second window after the first request) will. The only solution to this is to use the above ‘AcceptFilter … none’ configuration. Setting ‘KeepAlive On/Off’ makes no difference. The Apache error log shows this line: (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.

HostnameLookups

HostnameLookups should always be Off, as otherwise every request’s IP address will need to get resolved to a host or domain-name.

HostnameLookups Off

MySQL

127.0.0.1 over localhost

Always use IP address ’127.0.0.1′ instead of ‘localhost’, host-name, or a domain-name to make a connection to MySQL. Not doing so can cause delay issues due to Host file problems, improper DNS, routing between IPv4 and IPv6, domain resolves, and time-outs.

In 99.9% of all set ups, MySQL runs on the same system the PHP scripts are connecting from, and is bound to (listening-on) 127.0.0.1… All PHP scripts should be making the connection to MySQL directly via IP 127.0.0.1.

Make sure your scripts’ (and webapps’) configuration files do so, and that the MySQL account they use has its Host: field set to 127.0.0.1 so that connection is allowed.

Example Wordpess configuration -
C:\WampDeveloper\Websites\www.example.com\webroot\wordpress\wp-config.php

/** MySQL hostname */
define('DB_HOST', '127.0.0.1');

Example phpMyAdmin configuration -
C:\WampDeveloper\Tools\phpMyAdmin\config.inc.php

/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';

If a PHP script attempted to connect to MySQL via a host-name or a domain-name, that request would need to get resolved via DNS to an IP address, and that IP address would need to get routed back to a listening socket on the local system.

Also, if MySQL (and phpMyAdmin) will never be accessed from outside, you can disable MySQL’s DNS resolves and Host cache…

Edit my.ini, section [mysqld]:

skip-name-resolve
skip-host-cache

*With this change, you’ll need to make sure all MySQL accounts are set to Host: 127.0.0.1

MyISAM over InnoDB

If your database access pattern is mostly read-only (less than 15% writes – typical for most webapps like WordPress), try using MyISAM tables. But if it’s write heavy, consider
using InnoDB tables.

Database Buffer Size

Edit my.ini:

Try updating the buffer sizes to 1/4 or 1/2 of your RAM -

For MyISAM tables (caches indexes only, not the data)

key_buffer_size = 256M

For InnoDB tables (caches both indexes and data)

innodb_buffer_pool_size = 512M
innodb_log_file_size = 128M

innodb_log_file_size should be 1/4 of the innodb_buffer_pool_size value.

Changing the value of innodb_log_file_size will either cause MySQL to fail to start, or for the InnoDB Engine to not load. You’ll need to delete (or move out just in case) file(s) C:\WampDeveloper\Database\ib_logfile0 and ib_logfile1 (if it exists). This is a bit unclean, but if everything was flushed and shut down properly, should not be problematic.

The other settings I would not mess with. They hardly ever give anything more than marginal returns, or none at all.

Even the above mentioned settings will have diminishing results with increased values on the average system.

You’re mostly looking to update the existing settings (and not introduce new ones) to set the buffer-sizes of InnoDB and MyISAM to hold all indexes and data in memory as a percentage of your available RAM, and the log sizes as a percentage of the buffer sizes, and leaving everything else alone. As other settings are marginal, introduce complexity, are way too specific (and override good default and autos), or are just not good for the health of the Database.

innodb_flush_log_at_trx_commit

The only other MySQL setting that can produce good performance gains – changes the way the above buffer is written out to the above log file, and how the whole thing is flushed to disk.

innodb_flush_log_at_trx_commit = 2

http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_flush_log_at_trx_commit

The default value of 1 is required for full ACID compliance. With this value, the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file.

With a value of 0, any mysqld process crash can erase the last second of transactions. The log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but nothing is done at a transaction commit.

With a value of 2, only an operating system crash or a power outage can erase the last second of transactions. The log buffer is written out to the file at each commit, but the flush to disk operation is not performed on it. However, the flushing on the log file takes place once per second also when the value is 2. Note that the once-per-second flushing is not 100% guaranteed to happen every second, due to process scheduling issues.

PHP

data.timezone

Make sure php.ini has date.timezone set to a value. Otherwise PHP will attempt to figure out which data-time zone to use on every call to a date related function.

Surprisingly, an unset date.timezone value has drastic performance implications.

realpath_cache_size

Update php.ini’s realpath_cache_size to a much larger value from the default 16K.

realpath_cache_size = 1M

For this to work, open_basedir cannot be set, and safe_mode cannot be On. See – https://bugs.php.net/bug.php?id=52312

Webapps

Updated the webapp’s MySQL user account (via \phpmyadmin) to change the “Host:” field from “localhost” to “127.0.0.1″.

Then update the webapp’s config file to reflect the change.

For example, edit Magento’s configuration file -
…\domain.name\app\etc\local.xml

Update line -

<host><![CDATA[localhost]]></host>

To -

<host><![CDATA[127.0.0.1]]></host>

WordPress

Typical -
Reset the internal rewrite-rules in wp-options table by clearing the value via \phpmyadmin.

Ultimate -
Refresh the entire wordpress database by Exporting it into an XML file via the Import/Export plugin. Then re-install wordpress (delete the WP database and access the WP website), and re-import the XML file via that same plugin.

Drupal

Clear (truncate) the session table and watchdog table via \phpmyadmin.

Clear the Cache under Drupal > Configuration > Development > Performance.

Resetting MySQL Root Password

The official MySQL docs are not very clear (and also leave several parts out) on how to reset the MySQL root password -
http://dev.mysql.com/doc/refman/5.5/en/resetting-permissions.html#resetting-permissions-windows

It’s much simpler and easier than they make it out to be -

These instructions to reset the root password will work for any MySQL installation on Windows, including WAMP Server and XAMPP. But some of the file paths used here are specific to WampDeveloper (just update paths to your environment).

1. Reboot/restart your system.

2. Stop the MySQL Service.

You can do so via:
A) Command Line – Run cmd.exe as admin, then execute: net stop MySQL
B) Window Services Manager – Run services.msc, select MySQL Service, stop it.
C) WampDeveloper’s System Tab – Select MySQL Service, stop it.

3. Create file C:\mysql-init.txt with the following contents -

UPDATE mysql.user SET Password=PASSWORD('xyz123') WHERE User='root';
FLUSH PRIVILEGES;

This SQL will set the root password to: xyz123

4. Open the command-line as admin (via WampDeveloper’s System Tab), run this command -

mysqld --defaults-file=C:\\WampDeveloper\\Config\\Mysql\\my.ini --init-file=C:\\mysql-init.txt

*Note the drive letter of the WampDeveloper folder and the mysql-init.txt file path used, update to your environment.

This will attempt to start a MySQL process, using your my.ini file (which contains the needed paths to the Database folder and other settings), and on startup executing the SQL in the provided file (to change the root password).

5. You should now see a blinking cursor. The MySQL process is now running. After a few seconds, close the command-line window.

6. Terminate/exit the above running MySQL process by opening up another command-line window as admin and running this command -

mysqladmin -u root -p shutdown

When it asks you for the password, enter the above new root password: xyz123

7. Start the MySQL Service via WampDeveloper’s System Tab.

8. All root accounts (host: localhost, 127.0.0.1, ::1) can now be accessed by password: xyz123

Note – Opening the command-line or running cmd.exe “as admin”, means that the command-line instance has Administrative privileges granted to it. Simply double-clicking on cmd.exe will not usually open it in this mode. You have to right-click cmd.exe and select ‘Run as admin’. The command-line button in WampDeveloper’s System Tab always opens it in admin mode.

Accessing MySQL or phpMyAdmin From Outside

MySQL Access From Outside

To allow direct client connections to MySQL from outside systems…

Edit MySQL’s configuration file -
C:\WampDeveloper\Config\Mysql\my.ini

Change MySQL’s IP binding from “127.0.0.1″ to “0.0.0.0″:

bind-address = 0.0.0.0

This will allow MySQL to listen on all the assigned IPs of the system (including 127.0.0.1), such as the LAN IP and possibly the Public IP (if you’re not behind a Router).

Then you’ll need to -

Update the MySQL user account’s (the account to be allowed access to from outside) “Host:” field to either: “%” (which means it can be accessed from ANY IP) or to the specific outside system’s IP address. This part has nothing to do with the local IPs or the server’s public IP… It’s all about the client IP. You can do this via phpMyAdmin (Users Tab), or via the MySQL Shell.

* This is only done to allow direct-to-MySQL connections from outside, and is NOT done for accessing phpMyAdmin from outside. In the later case phpmyadmin always accesses MySQL locally (from 127.0.0.1).

* Remember to set the correct Windows Firewall rules to allow incoming port 3306 connections. Windows Firewall will block these by default.

phpMyAdmin Access From Outside

To allow login access to phpMyAdmin from an outside system…

Create MySQL Account

Login to \phpmyadmin locally (via user:root) and create 2 new user accounts with the same name and password, one with the “Host” field set to “127.0.0.1″ and one with the “Host” field set to “localhost”.

The “Host” field is set so because phpMyAdmin is a server-local script that always accesses MySQL from IP:127.0.0.1 (or Host:localhost) regardless of the logged in user’s location. The “Host:” value is what MySQL checks when a connection is established to it, and if it does not match, access is refused.

Grant this account specific permissions only on the databases it should be able to read/write.

Update phpMyAdmin Access Permissions

WampDeveloper provides an additional level of security to phpMyAdmin via a user-name/ip-address access list in phpMyAdmin’s config.inc.php file. All users are blocked by default (from non-local access) and have to be specifically white-listed.

Update the access list by adding in “allow mysql-account-user-name from all” to allow that account the ability to login to \phpmyadmin from any outside IP…

Edit phpMyAdmin’s configuration file -
C:\WampDeveloper\Tools\phpMyAdmin\config.inc.php

Insert access permissions for the username and the allowed IP address (or IP range) into the array:

/*
 *  phpMyAdmin does no user management and will not cross-check the MySQL account's host with the incoming connection's ip/host
 */
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
    'deny % from all',            // deny everyone by default, then -	
    'allow % from 127.0.0.1',     // allow all local users
    
    // allow user:root access from these locations (local network)
    'allow root from localhost',
    'allow root from 127.0.0.1',
    'allow root from 10.0.0.0/8',
    'allow root from 172.16.0.0/12',
    'allow root from 192.168.0.0/16',

    // add more usernames and their IP (or IP ranges) here -
    // ...

    "allow mysql-account-user-name from all",
);

* For this case: you do NOT need to switch MySQL from listening/binding on 127.0.0.1 to 0.0.0.0 (keep my.ini “bind-address = 127.0.0.1″), as phpMyAdmin is a local script that accesses MySQL locally regardless of the user’s IP.

* You should: create a new MySQL account to use for connecting from outside, give it only specific permissions on the databases it should be able to read/write, try not to re-use user:root, nor change any existing accounts.

* The only way to logout of phpMyAdmin is to fully close the Browser.

* WampDeveloper dosn’t have a password for user:root set by default (since it’s secured to local network access only). If you do set the password, make sure to do so for all root accounts (127.0.0.1, localhost, ::1), and update WampDeveloper.xml with the new password (if you need the WebApps Tab functionality to work).

Setting the default Timezone for PHP to use

The default time-zone used and displayed by PHP is UTC (Coordinated Universal Time)… Hence why it might look several hours off from your *local* time.

While sometimes it’s best to leave the internal time-zone of PHP set on UTC (as it is a international time standard) and then convert (in PHP code) the UTC date-time value to whichever time-zone you’d like to utilize and display…

To set your system’s or server’s PHP to use a specific time-zone…

Setting PHP’s Global TimeZone via php.ini

You can tell PHP to use your time-zone by setting the proper value of “date.timezone” in php.ini.

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

Change this -

date.timezone = "UTC"

To this -

For West Cost:

date.timezone="America/Los_Angeles"

For East Cost:

date.timezone="America/New_York"

For Central Time:

date.timezone="America/Chicago"

Save file (and be careful not to change it’s extension when doing so). Restart Apache.

The list of time zones for PHP is here -
For America
For the rest of the World

Setting PHP’s Per-Website TimeZone via VirtualHost

You also have the option of leaving PHP’s global default on UTC (in php.ini), but changing it per-website…

Edit the website’s HTTP and HTTPS VirtualHost files (select website in WampDeveloper’s Websites Tab, click the VirtualHost buttons to open those files). Then within the <VirtualHost> block, insert -

<IfModule php5_module>
php_admin_value date.timezone "America/New_York"
</IfModule>

Or use directive “php_value” in the above line instead – if you also want to allow .htaccess files and PHP scripts in that website to be able to further change that value at run-time.

Save the VirtualHost files. Restart Apache.

Note that this will only work if PHP is ran as an Apache module (mod_php), and not as a FCGI process (PHP-FCGI) because that process is separate from Apache and can’t be configured by it.

Setting PHP’s Per-Directory TimeZone via .htaccess

For setting the time-zone per PHP script’s folder/directory…

Edit the website’s .htaccess file and add in the proper “php_value” setting (note that you can’t use “php_admin_value” in .htaccess files) -

<IfModule php5_module>
php_value date.timezone "America/New_York"
</IfModule>

Save the .htaccess file. There is no need to restart Apache after .htaccess edits.

In some cases, the time-zone might already be set there already.

This is the more portable way of setting the proper PHP values for your websites and scripts, but as mentioned above, those directives only work for mod_php and do not work for PHP-FCGI.

Setting PHP’s Per-Script TimeZone via Code

Use the PHP function ini_set() to set your runtime values in script code…

ini_set("date.timezone", "America/New_York");

This is a good option if you are running PHP-FCGI, or are unable to make changes to php.ini, or can’t edit the website’s VirtualHost and .htaccess files.

date.timezone

It is important to always have a data.timezone value set. Otherwise, with this value undefined, PHP will:

1. Generate an error/warning for every time the date() and getdate() functions are called.

PHP Notice: in file /index.php on line x: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.

2. Attempt to guess which timezone to use via OS settings, environment variables, and algorithms. In some cases this can negatively impact server performance by a factor of 2-5x (especially PHP 5.3 on Windows)!