Install and Enable Zend Guard Loader for PHP 5.6

Zend Guard Loader has been released with support for PHP 5.6 (for Windows and Linux).

These instructions are specific to installing and enabling Zend Guard Loader for WAMP (such as WampDeveloper Pro), but will also work for Linux (with some path modifications matching your distribution)…

Make sure you are running PHP-FCGI and not PHP-regular (which is not supported by Zend Guard Loader). For Windows, 32 bits builds are provided; for Linux, both 32 and 64 bits are provided.

To use the correct PHP build & type if using WampDeveloper Pro – in Components Tab, select a supported PHP 5.6 VC11 Channel, with Bits:32 and PHP-Type:FCGI, then check mark a valid PHP version to use, and switch to the selected version.

Open file php.ini, find the existing “[IonCube]” section, and after it ends, place in –

[ZendGaurdLoader]
; ONLY PROVIDED UNDER PHP-FCGI
; The supplied opcache replaces your current opcache binary in order to allow correct extension loading. Disable existing php_opcache extension.
; If Ioncube is also loaded, Zend Gaurd Loader must be loaded AFTER Ioncube.
; If XDebug is also loaded, Zend Gaurd Loader must be loaded BEFORE XDebug.

zend_extension="C:\WampDeveloper\Components\Php\ext\ZendLoader.dll"
zend_extension="C:\WampDeveloper\Components\Php\ext\ZendLoader-php_opcache.dll"
zend_loader.enable=1

; Optional ZendGuardLoader configuration

; Disable license checks for performance reasons
zend_loader.disable_licensing=0

; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 - no obfuscation is enabled
zend_loader.obfuscation_level_support=3

; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide
zend_loader.license_path=

Make sure the default OPCache extension is disable and/or not loaded (as you have to use the modified version that came with Zend Guard Loader)…

[opcache]
; Determines if Zend OPCache is enabled
;opcache.enable=0

; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0
[Zend OPcache]
; Do not use this if using APC, or other opcode caches.
; If XDebug is also loaded, Zend Opcache must be loaded BEFORE XDebug.

;zend_extension="C:\WampDeveloper\Components\Php\ext\php_opcache.dll"
;opcache.enable=0

Save file php.ini for changes.

Place the downloaded Zend Guard Loader extension files from the zip into …Php\ext\, but do rename the new “php_opcache.dll” file to “ZendLoader-php_opcache.dll” (instead of overwriting the existing file).

Start Apache.

Check phpinfo() to see if the extension has been loaded successfully, otherwise check the PHP error log file.

MySQL 5.7 Start Error “TryAcquireSRWLockExclusive could not be located…”

mysqld error TryAcquireSRWLockExclusive

Supported OS

MySQL 5.7 no longer supports Windows Vista nor Server 2008 (nor the 32 bit version of Server 2008 R2). This is the cause of the above error message.

MySQL 5.7 supports Windows 7 and upwards, and Server 2008 R2 (64 bits) and upwards.

Built For Runtime

MySQL 5.7 also now uses the Windows Visual Studio 2013 (VC++ 12.0) run-time, which is not present on some systems and will require installation.

Other Changes

Also for those downloading the “no install” zip package (vs. the msi-installation package) of MySQL 5.7, note that this package no longer contains the expected:

Using Latest Apache, PHP, and MySQL Versions with WampDeveloper Pro

WampDeveloper Pro and its components (AMP versions) are completely separate, and you can always use the latest versions of these components from outside – with some slight modifications. You can also provide your own custom builds of Apache and PHP.

WampDeveloper only needs to be able to parse the Apache, PHP, MySQL version information from the folder-name to be able to switch/use that version…

If the AMP version is not officially provided by WampDeveloper, you can download it from another site and place it under a properly named folder:

\WampDeveloper\Versions\<component>\name-version-release-bits-compiler-tag\

* Not all versions are compatible with one-another, some properties must match between AMP builds.

Also, if any *extra* Apache or PHP modules/extensions are used (such as IonCube, XDebug, …), you will need to copy them from a build-compatible provided version and into the new version (or re-download those modules/extensions from their official sites).

Channels

The Channels are defined in file WampDeveloper.xml, and you can modify your copy to add a “PHP7″ channel like so…

<channel name="PHP7" exclude_os="XP, Server 2003">
  <component name="Apache" branch="2.4" compiler="VC14" binary_path="bin\httpd.exe" />
  <component name="Mysql" branch="5.6" compiler="VCX" binary_path="bin\mysqld.exe" />
  <component name="Php" branch="7.0" compiler="VC14" binary_path="php.exe" />
</channel>

MySQL

Link: http://dev.mysql.com/downloads/mysql/5.6.html#downloads

Download: “Other Downloads: Windows (x86, 32-bit), ZIP Archive”.

Then place it as folder –

\WampDeveloper\Versions\Mysql\mysql-5.6.35.0-r1-win32-vcX-standard\

Apache

Link: http://www.apachelounge.com/download/

Download: “httpd-2.4.25-win32-VC14.zip”.

Then place and rename the inside “Apache24″ folder as –

\WampDeveloper\Versions\Apache\apache-2.4.25.0-r1-win32-vc14-apachelounge\

If there are any issues starting Apache, google for “Visual C++ redistributable for Visual Studio 2015″ and install the English 32 bit version.

mod_fcgid.so

If the PHP type you are using is FCGI, Apache has to load mod_fcgid instead of mod_php. mod_fcgid is not part of the standard Apache distribution…

Copy in file mod_fcgid.so from the previous version’s modules\ folder, of the same bits and compiler (e.g., 32 bits, VC14 build) into the new version’s modules\ folder, or Apache will not start and produce error “Cannot load modules/mod_fcgid.so into server: The specified module could not be found.”.

Or download the proper win32 VC14 mod_fcgid.so build from the above apachelounge link.

PHP

Link: http://windows.php.net/download/

VC14 x86 Thread Safe

Download: “php-7.0.15-Win32-VC14-x86.zip”.

Then place as folder –

\WampDeveloper\Versions\Php\php-7.0.15.0-r1-win32-vc14-standard\

VC14 x86 Non Thread Safe

Download: “php-7.0.15-nts-Win32-VC14-x86.zip”.

Then place as folder –

\WampDeveloper\Versions\Php\php-7.0.15.0-r1-win32-vc14-standard-fcgi\

Update Configuration Files for PHP7

Download WampDeveloper PHP7 upgrade files from –
http://www.devside.net/wp-content/uploads/2017/02/WampDeveloper-PHP7-upgrade-files.zip

Replace the updated php-70.ini file in folder –

\WampDeveloper\Config\Php\

Then open php-70.ini in an editor (Notepad will do), and search-replace all instances of these two path strings updated for the drive letter WampDeveloper is on –

D:/WampDeveloper –> C:/WampDeveloper
D:\WampDeveloper –> C:\WampDeveloper

The other 3 updated files (wampd-php7.conf, wampd-php-fcgi.conf, wampd-phpmyadmin.conf) need to also be replaced in \WampDeveloper\Config\Apache\extra\, with the same path changes.

phpmyadmin

You can update phpmyadmin by renaming \WampDeveloper\Tools\phpmyadmin\ to phpmyadmin.old, unzipping new version in its place, and copying in the older version’s config.inc.php file into place.

Depending on its version, you might or might not need to re-install phpmyadmin’s database –

mysql -u root -p
DROP DATABASE phpmyadmin
SOURCE C:/WampDeveloper/Tools/phpMyAdmin/sql/create_tables.sql
exit

(update for drive letter)
(if root has no password set, leave the -p switch out)

WordPress Downloading Update with Fatal Error “Maximum execution time of 60 seconds exceeded”.

When updating WordPress, this error might not be what it seems –

PHP Fatal error: Maximum execution time of 60 seconds exceeded in C:\WampDeveloper\Websites\domain.name\webroot\wp-includes\class-http.php on line 1610.

Fix – Disable all modules before doing the upgrade. Lots of errant modules freeze everything when WordPress is upgrading itself.

Other Causes – If an errant module is not the issue, run a phpinfo.php file with <?php phpinfo(); ?> in the website’s webroot (DocumentRoot) folder to see what value of max_execution_time is set at in php.ini.

Check .htaccess, VirtualHost files, php.ini, WP’s wp-config.php for any additional/overriding settings.

Another Cause – Sometimes hard-coded time limits are set in WordPress’s script files.

Run a string search of all *.php files in WordPress’s folder for strings:
A) “set_time_limit” –
looking for set_time_limit(60);
B) “max_execution_time” –
looking for ini_set('max_execution_time', 60);

Changing WampDeveloper’s Default Text Editor and Browser

Is there any way to change the default Text Editor and/or Browser?

I absolutely HATE notepad.
I absolutely HATE Internet Explorer.

Hopefully it can be done!

The user-interface of WampDeveloper opens (outside of it):

  • Via Notepad – text based files such as websites’ VirtualHost files, website access and error log files, Apache/PHP/MySQL error log files, and Apache/PHP/MySQL configuration files.
  • Via IE – websites and their URLs.

For the users that prefer to use another Editor and/or Browser there is a solution.

Website Browser

WampDeveloper will use whichever Browser is set as default on Windows…

You can set the default Browser choice in –

Control Panel > Default Programs

You can usually also set this from within the Browser… For example in Chrome’s menu, select Settings, and in the "Default browser" section, make it so. But if that does not work, you’ll have to set it manually as above.

File Editor

WampDeveloper is configured to use Notepad, as it is the simplest editor for the task at hand (except for the task of opening very large log files).

To change to another editor –
1. Edit file WampDeveloper.xml.
2. In the values group, change the value of the key named editor from "notepad.exe" to the application name of your Editor (no quotes).

Restart WampDeveloper for changes to take effect. If WampDeveloper will not start after making the WampDeveloper.xml edit, the XML structure is not correct – delete file, start WampDeveloper again, and it will re-create this file.

If this Editor’s location is not in the system’s "Path" environmental variable (that holds all the locations to check for the provided file-name), you should be able to place the full path as the value above.

Otherwise, you can also insert the Editor’s folder into the system’s "Path" environmental variable…

1. Control Panel > System > Advanced tab, click Environment Variables.

2. In "System Variables" group, edit the "Path" (or "PATH") variable by adding to the end of its string:

;"C:\Program Files\Editor\exe-containing-folder\"

* The semi-colon (;) separates all the paths from each other by signifying the ending of one path and the beginning of another, and the quotes (") around the path is used when there is a space in that path.

3. Restart system for changes to the Environment Variables to fully propagate and take effect (* this is not always necessary).

How to automatically restart Apache Service on Windows (and recover from crash)

Automatic Service Recovery

Use Windows’ built-in Service Recovery to restart Apache on each crash.

Run services.msc.

Select/open the Apache service.

(WampDeveloper’s Apache service is named “WAMPDev.Apache”)

Under Recovery, select to restart the service on each crash…

First failure: Restart the Service
Second failure: Restart the Service
Subsequent failures: Restart the Service

Reset fail count after: 1 day
Restart service after: 1 minute

(no other options selected)

This will attempt to restart Apache on a crash, after waiting 1 minute.

Limitations

The above Service Manager will only restart a crashed Service if that service crashes with a returned non-zero exit code…

If the service crashes in any other way, such as with a zero value, or such as with no exit code – the Manager will NOT attempt to restart the Service. As that would suggest the crash was completely uncontrolled (i.e., the process blew up / the process did not catch nor handle any of the inner exceptions), and that the issue will continue to persist without further user-intervention.

Note that when Apache exits with error code 255, it is restarting itself automatically due to normal operations (such as when reaching the Recycle workers count), and this does not affect the Windows Services Manager restart counts…

[Sun Oct 30 13:28:15 2011] [notice] Parent: child process exited with status 255 -- Restarting.
[Sun Oct 30 13:28:16 2011] [notice] Apache/2.2.20 (Win32) mod_ssl/2.2.20 OpenSSL/0.9.8r configured -- resuming normal operations

(WampDeveloper’s path to log file is C:\WampDeveloper\Logs\Apache\httpd.host.errorlog.txt)

Windows Tasks

You can setup Windows Tasks to monitor and restart the Apache service via either a Batch file or a PHP script.

A script can also check your websites, and restart the Apache service if no response arrives.

Note that all Tasks need to be elected to run with elevated privileges since a Service is being controlled.

Batch File

The simplest possible Task is to just keep starting Apache every X minutes. If the service is already running, the command will be ignored…

net start WAMPDev.Apache

For more advanced options, check –
StackOverflow’s How to check if a service is running via batch file and start it, if it is not running?
SuperUser’s Automatically restart Windows service if it is not running.

PHP Script

Instead of a bat/batch file, you can also schedule a PHP script to execute via an independent/stand-alone PHP process…

Use run path:

C:\WampDeveloper\Components\Php\php.exe -n -f "C:/path/to/script.php"

The “-n” switch tells PHP not to load php.ini: no extensions, default settings. This would be ideal for simple scripts.

Application Monitoring

If the native Windows Task Recovery does not work, and/or for more advanced options, you would need an application to monitor and restart the service such as ServiceProtector or AlwaysUp.

Running Apache and MySQL side-by-side with IIS (or WebMatrix and Web Platform)

As a rule, only 1 process is allowed to bind to a specific IP:port (an interface). And the first process that takes that specific IP:port will prevent all other processes, that use the same IP:port, from starting…

Apache and IIS will both try to take port 80 (the HTTP port) and port 443 (the HTTPS port) – on IP “0.0.0.0”.

MySQL will try to take port 3306 (the default MySQL port) – on either IP “0.0.0.0” or IP “127.0.0.1”.

“0.0.0.0” specifies binding to all IP addresses the system has, including 127.0.0.1. And “127.0.0.1” is the standard localhost IP – used to bind services for local-access only.

To run multiple servers side-by-side (on the same system), 3 options are available (from the very simple to the more complicated):

A) Run Only 1 Platform at a Time

Stop IIS, start Apache. And vice-versa.

With multiple MySQL instances, run 1 instance at a time.

Note that when using both MySQL and SQL Server, you can run both at the same time as they use different ports (and they will not conflict).

B) Keep Listeners Bound to the Default IP(s), But On Different Ports

This is only a valid solution for local use and local development.

Select each website in IIS (including the Default Website), change the binding properties from *:80 and *:443 to other ports such as 8080 and 8443.

Update Web Platform’s MySQL’s my.ini file to change “port = 3306″ to another port such as 3307.

Update URLs to Use New Ports

With the above re-binding, all IIS websites will now be reachable from URL:

http://domain.name:port/

How URLs Work

By convention, all web-servers use the same standard ports (for HTTP and HTTPS)…

When a request is made from your Browser to http://domain.name/path/, it resolves the domain name to an IP address, and the request is automatically sent to that IP on port 80 (and to port 443 for HTTPS traffic).

In effect, all standard URLs (i.e., without a user specified port) are short-hand for:

http://domain.name:80/
https://domain.name:443/

Update Database Connections

Webapp configuration files, other script files, and any programs that connect to Web Platform’s MySQL, will need to be updated to reflect the new port number to use.

This includes phpMyAdmin (phpmyadmin\config.inc.php).

C) Keep Default Ports, But Bind Listeners On Separate IP Addresses

Your system will likely have:

  • 1 Public IP
  • 1 LAN IP (such as 192.168.0.1 – which is accessible from all LAN connected systems and devices)
  • 1 localhost/loopback IP 127.0.0.1 (only locally reachable)
  • Many IPs in the range of 127.0.0.xx (that are only locally reachable)

It is best to have WampDeveloper’s Services include the use of IP 127.0.0.1 – otherwise you’ll have to use an editor to do an auto-search for all instances of 127.0.0.1 (and some variations that can be picked up with string “127”) in WampDeveloper’s folder to update the local configuration structure for use of another local IP.

Bind Apache from the default of “0.0.0.0” to specific IPs (including IP 127.0.0.1). And Web Platform’s IIS to another specific IP. And perform the same for multiple MySQL servers…

For Apache

Edit file – C:\WampDeveloper\Config\Apache\httpd.conf
Replace these two lines (one is at the beginning, the other at the end) –

Listen 80
...
Listen 443

With –

Listen ip.address.here:80
...
Listen ip.address.here:443

Preferably also include Listen 127.0.0.1:80 and Listen 127.0.0.1:443.

For Web Platform

Select all websites (including Default Website) in IIS and change their bindings to the other IP.

If another instance of MySQL was installed (via Web Platform), edit its “C:\Program Files\MySQL\MySQL Server\my.ini” file and change bind-address = 127.0.0.1 to the other IP.

If you have to keep Web Platform’s MySQL server on 127.0.0.1, bind WampDeveloper’s MySQL to something other than 127.0.0.1:

Edit file – C:\WampDeveloper\Config\Mysql\my.ini
Update line bind-address = 127.0.0.1.

Edit file – C:\WampDeveloper\Tools\phpMyAdmin\config.inc.php
Update all instances of “127.0.0.1” (that is used for the connection IP and in the access control list).

ProxyPass

You can run multiple servers at the same time and use the ProxyPass feature to have Apache act as the front-end, transparently proxying requests back-and-forth for specific URLs and websites.

This way you can have 1 public-facing server (Apache on port 80) serving all requests, and multiple back-end servers such as IIS and Tomcat running websites and scripts that use ASP.NET and Java.