Running Perl Scripts

WampDeveloper Pro is primarily a PHP web-server, but it does come with Perl (StrawberryPerl distribution), and is able to run Perl scripts out-of-the-box.

Simple Perl Scripts

For simple single-file Perl scripts (and not entire Perl based applications), just place the Perl scripts into the website’s already existing \cgi-bin folder (it is outside of \webroot) –
C:\WampDeveloper\Websites\www.example.com\cgi-bin\

Then you can access those scripts via URL –
http://www.example.com/cgi-bin/script-file-name.pl

The provided \cgi-bin folder is configured to treat all files in it as executable CGI scripts (regardless of their file-name extension), and also does not allow for .htaccess files.

Entire Perl Applications

For more complicated Perl applications –

Because of the size and complexity of some Perl applications, it is not going to be good enough to place these perl applications into the website’s default \cgi-bin folder… We will rather have to place the application into the website’s \webroot folder, and enable CGI execution in the application’s folder…

Edit the website’s VirtualHost file (select website in Websites Tab, click VirtualHost buttons), inside the <VirtualHost> block add in…

<Directory "C:/WampDeveloper/Websites/www.example.com/webroot/perl-application-folder-to-enable-cgi-for">    
    Options -Indexes +ExecCGI
    AllowOverride All
    
    Order allow,deny
    Allow from all
    
    # Execute file-names with .cgi and .pl extensions
    AddHandler cgi-script .cgi .pl

    <IfVersion <= 2.2>
    # Clients should be allowed to figure out the content-type themselves (for unknown/not-set mime types)
    #DefaultType text/html
    </IfVersion>
</Directory>

Also, inside the above Directory block in the HTTPS VirtualHost, add line:
SSLOptions +StdEnvVars

Save files. Restart Apache.

If Apache won’t start, from the command-line (button in System Tab), run –

httpd -t -n "WampDev.Apache"
httpd -k start -n "WampDev.Apache"

This will tell you which lines in the VirtualHost file have errors in them.

Extra Perl Modules

Some Perl applications might also require extra Perl modules to be installed. To do so, open the command-line (button in System Tab) –

Then run something similar to this (substitute in package-names) –

perl -MCPAN -e shell;
install package::name1
install package::name2
...
exit

This might, or might not, work out well – depending on the extra modules and what they require.

Increasing Apache + PHP Limits and Timeouts

Apache, PHP, and phpMyAdmin have multiple configuration settings that set (and limit):

  • Memory Usage (Allocation)
  • PHP Script Run Times
  • Upload File Sizes

These instructions will work for both Apache on Linux and for all WAMP-servers (Apache on Windows). But all the directory and file paths used here are specific to WampDeveloper Pro (…just substitute in the paths of your environment).

Increasing File Upload Limits

For uploading large files there are Apache and PHP memory limits and timeout values set that you might need to update…

PHP

Open and edit file php.ini – C:\WampDeveloper\Config\Php\php.ini

These two settings define the maximum file upload size:

upload_max_filesize = 256M
post_max_size = 257M

This will increase upload limits on a single file to 256 MB, from the default of 2 MB.

post_max_size” is set 1 MB larger than “upload_max_filesize” to take into account for any additional meta-data about the file that is included in the request (e.g., Header data).

If multiple files are uploads in the same POST request, then post_max_size will need to be set greater than the size of all the files combined (i.e., post_max_size > upload_max_filesize * number-of-files + 1MB * number-of-files).

Related PHP Settings

1. file_uploads

file_uploads = On

“file_uploads” has to be on. And usually is by default under most WAMP and LAMP setups.

2. memory_limit

memory_limit = 258M

While the PHP docs state that “memory_limit” should generally be set higher than the “post_max_size” value, is not absolutely required to be so, because file uploads are not stored/output *in their entirety* to memory. Instead, they are buffered part-by-part and written out to a file in the temporary directory (C:\WampDeveloper\Temp\) as the upload progresses.

This setting does not usually affect or limit uploads (nor downloads).

3. upload_tmp_dir

upload_tmp_dir = "C:/WampDeveloper/Temp"

This is the directory where file uploads are temporarily placed. It has to exist, and has to not have special/restrictive permissions set on it. Also there must be enough free disk space on this partition, and no overly restrictive space quotas set on this directory.

If you are using your own coded scripts to do file uploads, note that the file will be deleted from the temporary directory automatically by PHP at the end of the request. Before the script exits, you must move or copy away the file.

4. max_input_time and max_execution_time

max_input_time = 300

“max_input_time” is the amount of time a PHP script can spend “parsing” input data. The default is 60 seconds. Also, this (input “parsing” time) does not count towards the “max_execution_time” limit.

max_execution_time = 300

“max_execution_time” has no effect on upload time limits (i.e., you don’t need to modify “max_execution_time” for file uploads).

Important – these settings are limits on the possible “processing” time of the data, and not on the actual upload time itself (i.e., client upload time does not count towards max_input_time and max_execution_time).

5. max_file_uploads

max_file_uploads = 20

“max_file_uploads” sets the maximum number of files (default is 20) that can be uploaded by a single POST request (via form submit). If you are uploading more than 1 file at a time, you’ll also have to set “post_max_size” to a greater value than “upload_max_filesize” times “max_file_uploads”.

http://php.net/manual/en/features.file-upload.post-method.php
http://php.net/manual/en/features.file-upload.common-pitfalls.php

PHP-FCGI

When using PHP-FCGI (a separate PHP process ran via Apache’s mod_fcgid), mod_fcgid caps uploads to 128KB by default in newer versions (v2.3.6 and above), and usually returns a “500 Server Error” when that limit is reached.

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

Inside the <IfModule fcgid_module> block, add in or edit setting:
FcgidMaxRequestLen 268435456

This will set the max upload value to 256 MB. Or for a 1GB (1024MB) upload limit, use value: 1073741824.

You should probably set this to match whatever max upload value you have in php.ini – though it does not have to be so.

Also for uploading and downloading files, this timeout needs to reflect the time it takes to upload/download the file:
FcgidBusyTimeout 300

Apache

Apache sets by default LimitRequestBody to 0 (specifying an unlimited size limit on the request).

This value can be overridden in any .htaccess file to another value.

Increasing Execution Timeout Limits

For processing requests there are Apache and PHP timeout values set that you might need to update (the default timeout is usually set to 300 seconds / 5 minutes)…

Apache Wait Time for Input/Output

Edit file C:\WampDeveloper\Config\Apache\extra\httpd-default.conf
Timeout 300

http://httpd.apache.org/docs/2.2/mod/core.html#timeout

PHP Script Processing & Runtime Limits

Edit file C:\WampDeveloper\Config\Php\php.ini
max_execution_time = 300

http://php.net/manual/en/info.configuration.php#ini.max-execution-time

PHP FastCGI Processing Timeout

When running PHP-FCGI, the FastCGI configuration sets a value on the time a FastCGI application has to respond to the I/O request (default is 40 seconds)…

Edit file C:\WampDeveloper\Config\Apache\extra\wampd-php5-fcgi.conf
FcgidIOTimeout 300

Also for busy scripts, this timeout needs to reflect the time it takes those scripts to finish:
FcgidBusyTimeout 300

Increasing PHP Memory Limits

PHP has a limit set on the amount of memory a PHP script is allowed to allocate.
memory_limit = 258M

Generally you don’t want to set a value above 2000MB (slightly lower than 2GB / 2048MB) as it 1) begins to exhaust the memory space PHP can use running as a 32 bit process and 2) has been known to trigger PHP bugs. Though normally it shouldn’t need to be higher than 1024MB as anything above is usually indicative of bad memory management or memory leakage by the PHP script used.

.htaccess and PHP code that overrides php.ini settings

If you are experiencing an Apache or PHP error message:

Out of memory (allocated X) (tried to allocate Y bytes)

Try using Notepad++ (which has a nice Find-in-files search feature), or your own choice of an Editor, to search your website’s DocumentRoot (\webroot) folder:
C:\WampDeveloper\Websites\domain.name\webroot\

…For all files; And for all occurrences of this text/string:
memory_limit

…To see if “memory_limit” is being set in any .htaccess files (via directive: “php_value”) or PHP files (via function: “ini_set()”). Then manually edit or comment out those lines.

A) An .htaccess file could override php.ini’s memory_limit:
php_value memory_limit 20MB

B) A PHP script could override php.ini’s memory_limit:
ini_set("memory_limit","20M");

Also note that the website’s VirtualHost file can set a value that is not overridable via .htaccess files nor script code by using the “php_admin_value” directive:
php_admin_value memory_limit 258MB

Increasing phpMyAdmin Limits

phpMyAdmin has a default limit of 300 seconds set on the import and export of dump (SQL) files. This setting does not affect the run time of any other phpMyAdmin functions.

Edit file C:\WampDeveloper\Tools\phpMyAdmin\config.inc.php
$cfg['ExecTimeLimit'] = 300;

phpMyAdmin also has a $cfg[‘MemoryLimit’] setting that limits the amount of memory a script can allocate for importing and exporting SQL files (and on some other internal functions), but its default value is already set with no limit:
$cfg['MemoryLimit'] = '0';

*If you do set this value for some reason (instead of letting PHP handle this limit), to specify megabytes, append an “M” to the value.

Opening Up Port 80 For Apache to Use On Windows

For Apache to be able to start/run, it has to be able to bind to (and listen on) port 80 (the HTTP port).

If after installing Apache (or a WAMP such as WampDeveloper Pro), rebooting, and trying to start Apache again – Apache is not able to bind to port 80 and start, then another Application or Service has already taken this port.

For Apache to start, we have to figure out what’s using port 80 (and possibly port 443) on your system, and stop and disable it.

Known Windows Services That Listen on Port 80

From Services Manager (run: services.msc), stop and disable these Windows Services which are known to bind to port 80.

Double click Service, and change ‘Startup Type’ to ‘Disabled’…

  1. SQL Server Reporting Services (ReportServer)
  2. Web Deployment Agent Service (MsDepSvc)
  3. BranchCache (PeerDistSvc)
  4. Sync Share Service (SyncShareSvc)
  5. World Wide Web Publishing Service (W3SVC)
  6. Internet Information Server (WAS, IISADMIN)

You might, or might not, have some of these Services installed and running.

These services are not needed for normal Windows functionality, and can be safely disabled.

HTTP (HTTP.SYS) Hidden Driver/Service

Windows Server 2003/2008/2012 and Windows XP(SP2)/Vista/7/8/10 comes with an HTTP front-end proxy service who’s job is to parse and forward incoming HTTP requests to other Services.

Values in URL “http://hostname:port/virtual_url_or_dir” are registered with it, and when an HTTP request comes in that matches on those values, that request gets routed to the other application or service (which itself is running on a different port).

HTTP.SYS is usually started “on demand” by other services (Windows Remote Management, Print Spooler, etc), and is not usually listening on port 80 until some other application registers a HOST (127.0.0.1) + PORT (80) + virtual URL/DIR with it. HTTP.SYS runs under PID 4 (NT Kernel).

On some Windows systems, oftentimes port 80 is already taken by HTTP.SYS for use.

Show Reserved URLs:

netsh http show urlacl

Show active Registered URLs:

netsh http show servicestate

To Disable HTTP.SYS:

Control Panel > Device Manager
In menu View, select: Show hidden devices
Open tree: Non-plug and Play Drivers
Double-click: HTTP
Tab Driver - Group Startup
Switch from: Demand to Disabled

Or run this from the administrative privledged command-line (right click cmd.exe, select – run as admin):

net stop http /y
sc config http start= disabled

Other Web-Server Applications

Make sure you’re not running:
A. Other instances of Apache
B. IIS and/or WebMatrix
C. Tomcat

IIS and Tomcat are web-server applications that also bind to port 80 by default.

IIS can be removed via Windows Features on Vista/7/8/10, or on Windows Server via Role and Components Removal.

Skype

Skype usually takes up ports 80 and 443.

You’d need to stop Skype and change its settings to not use these ports:

Tools > Options > Advanced > Connection
Uncheck "Use Port 80 and 443 for incoming connections"

Or set Apache’s Startup type as “Automatic”, this way Apache might start before Skype does, and will be able to bind to port 80 and 443 before any other application has a chance to take these ports.

* Skype for Windows 8 (Modern UI) is not able to change port numbers. Only “Skype for Desktop” can do this.

TeamViewer

Check both Tasks Manager (Processes Tab – click ‘Show processes from all users’) and Services Manager to see if you have “TeamViewer” running… This process or service waits several minutes after computer start-up, and then takes port 80 if it’s available. If present, you should stop and disable it too, or configure it not to use port 80…

Disable TeamViewer from using port 80:

Extras > Options > Advanced
Enable option "Don't use incoming port 80"

Windows Work Folders

Under Windows Server 2012 R2 and Windows 8, Microsoft has introduced a new feature called “Work Folders”, that synchronizes files/folders between different machines.

By default, “Work Folders” uses ports 80 and 443!

There are 3 options to get around this, from simplest to more difficult…

A) Disable the Windows ‘Sync Share Service’, named “SyncShareSvc”.

B) Remove/ “Work Folders” Server Role / Windows Feature:

Launch Server Manager. Click "Add roles and features".
Server Roles -> File and Storage Services -> File and iSCSI Services -> Work Folders

C) Or change the ports “Work Folders” use:

Edit file:
C:\Windows\System32\SyncShareSvc.config

Change ports from 80 to 11180 and 443 to 11443 (or something else)…

<sites>
...
    <bindings>
        <binding protocol="http" bindingInformation="*:80:" />
        <binding protocol="https" bindingInformation="*:443:" sslFlags="0" />
...

Then from a permissions-elevated command-line (right click cmd.exe, Run as admin), run:

Netsh http add urlacl url=http://*:11180/ user="NT Authority\LOCAL SERVICE"
Netsh http add urlacl url=https://*:11443/ user="NT Authority\LOCAL SERVICE"

You’ll also need to follow more instructions here:
http://blogs.technet.com/b/filecab/archive/2013/10/15/windows-server-2012-r2-resolving-port-conflict-with-iis-websites-and-work-folders.aspx
http://kylejwx.wordpress.com/2014/03/06/work-folders-on-windows-server-2012-r2-essentials/

VMware Host Agent service

The VMware Host Agent service uses TCP ports 80 and 443 by default.

Edit > Preferences > Shared VMs
Change the ports

VMware, Configure Virtual Machine Sharing and Remote Access

Use NETSTAT to Detect Port 80 Listeners

Open the command line (System tab, button: Command Line) and run:

netstat -o -n -a | findstr 0.0.0.0:80
netstat -o -n -a | findstr 127.0.0.1:80

Inspect the lines with a “Local Address” showing port 80 and/or 443 in use. Note the PID number. Then open Task Manager (run: taskmgr.exe), and in Processes tab, see if you can find the application with that same PID number. This app needs to be shut down. If you don’t see it, click “Show processes from all users” button.

http://support.microsoft.com/kb/281336

On newer Windows versions you can get the application name directly by using netstat’s ‘-b’ option:

-b    Displays the executable involved in creating each connection or
      listening port. In some cases well-known executables host
      multiple independent components, and in these cases the
      sequence of components involved in creating the connection
      or listening port is displayed. In this case the executable
      name is in [] at the bottom, on top is the component it called,
      and so forth until TCP/IP was reached. Note that this option
      can be time-consuming and will fail unless you have sufficient
      permissions.

Apache Startup and Running Issues

Apache Startup Issues

When Apache does not start after installation, nor after a system restart, chances are that another process or service has already taken ports 80 (the HTTP port) and 443 (the HTTPS / SSL port).

This can be –

  1. Other web-server applications such as: IIS, Tomcat, Nginx, etc.
  2. Unrelated applications such as Skype.
  3. Windows Services such as BranchCache.

Only one application is allowed to bind-to/listen-on a specific port.

Test Apache by executing this from the command line…

httpd -t -n "Apache2"
httpd -k start -n "Apache2"

(*use the proper Apache Service name, they are different for different versions and WAMPs – see below section)
(*run commands from an administrator level command-line: right-click cmd.exe, select ‘Run as admin’)

The first command will test Apache’s configuration, the second command will attempt to start Apache. Helpful error messages will be shown.

If the error message is similar to:

“An attempt was made to access a socket in a way forbidden by its access permissions. make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down.”

…then we know that another application has binded to (taken) port 80 and/or 443.

Stop and disable IIS if it’s running. Stop Skype. Stop the BranchCache Service.

See this guide for a larger list of port 80 listeners: Opening Up Port 80 For Apache to Use On Windows

See this guide for running Apache and other web-servers side-by-side, but on different IPs: Binding Apache to a Specific Or Secondary IP Address

Apache Service Names

WampDeveloper Pro uses the following Apache Service names:

  • WampDeveloper v5: “Apache2″ (it is the same for all Apache versions – 2.4, 2.2, 2.0)
  • WampDeveloper v4: “Apache2.2″ (only Apache 2.2 is provided)

Default Apache Service Names:

  • Apache 2.4: “Apache2.4″
  • Apache 2.2: “Apache2.2″
  • Apache 2.0: “Apache2″

Apache Configuration Issues

Otherwise, the issue is most likely a configuration problem (syntax issue), and running a syntax check will let you know which configuration files and lines are incorrect.

httpd -t -n "Apache2"

Note that only the first encountered issue is reported, and once corrected, there could be more issues shown.

Apache Running Issues

If Apache starts, but after some time stops responding to requests (e.g., does not properly load websites and serve pages), there is most likely an issue with the OS’s networking layer.

Disable Use Of Advanced Networking Functions

On some systems the networking layer is slightly broken due to 3rd-party software that manipulates it and/or attaches filters to it.

[Tue Oct 01 19:22:29 2013] [warn] (OS 995)The I/O operation has been aborted because of either a thread exit or an application request. winnt_accept: Asynchronous AcceptEx failed.

Edit file –
C:\WampDeveloper\Config\Apache\extra\httpd-mpm.conf

Disable Apache’s use of Windows’ more advanced (faster) networking functions –

EnableMMAP off
EnableSendfile off

Win32DisableAcceptEx

If you are using Apache 2.4, instead of Win32DisableAcceptEx (which is only for Apache 2.0/2.2), use this –

AcceptFilter http none
AcceptFilter https none

Save file. Attempt to start Apache.

If this does not help, remove the changes made – as the above directives can cause their own problems later on.

Reset Networking Layer to Default State

Attempt to fix Winsock and the TCP/IP stack by reseting them. This will remove all the 3rd-party filters registered with it (from network, firewall, proxy, and anti-virus software installs).

From the command line run this and 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’)

You can see a current list of attached filters (LSPs) with this command –

netsh winsock show catalog

Required Microsoft VC++ Redistributable Packages

If Apache is not able to install or start and there are no displayed (nor logged) errors, or a Messagebox about a missing MSVCR90.dll or MSVCR110.dll file pops-up, Windows is missing the required Microsoft VC++ runtime DLLs.

For Apache 2.4 compiled under VS.NET 2012 (VC11) download and install Visual C++ Redistributable for Visual Studio 2012 Update 4.

For Apache 2.2 compiled under VS.NET 2008 (VC9) download and install Microsoft Visual C++ 2008 Service Pack 1 Redistributable Package.

Sending Mail by Apache, PHP, and Webapps

Apache with PHP is purely a web-server role, and while PHP has a mail() function – it is absolutely useless if not properly configured to connect to a real mail server, and is not even capable of doing authentication (i.e., submitting the user+password login information to the mail server account).

For PHP scripts and webapps (like WordPress, Moodle, Prestashop, Drupal, Joomla) to be able to send out e-mail, PHP must be able to first connect to a mail server or an email account.

Running and setting up a full local mail server can be a complicated task, so here are some simpler options for you –

If you have access to a Gmail, Hotmail, or Yahoo account, or an SMTP server (mail server) that’s set up to handle your domain name, you can get any Apache + PHP environment (or WAMP such as WampDeveloper Pro), to use any of these options to send out emails…

Use “msmtp”

msmtp is a local SMTP application that pretends to be a real SMTP server, but which really just uses your Gmail, Hotmail, or Yahoo account instead; or any SMTP server (mail server) you’ve configured it to use, that it transmit everything to –

* Make sure to get version 1.4.31 or above, and not v1.4.30 due to a bug.
* WampDeveloper Pro v4.2+ already comes with msmtp v1.4.31 (there is no need to download anything).

1. Download and unzip msmtp into folder –
C:\WampDeveloper\Tools\msmtp
(* C:\WampDeveloper\Tools\msmtp\msmtp.exe should be a valid path afterwards)

2. Create file C:\WampDeveloper\Tools\msmtp\msmtprc.ini and place this configuration inside –

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

# Local Mail Server Account
# This is the simplest example - a mail server on the local network, standard port 25, with no encryption layer
account LocalMailServer
host mail.lan.host
port 25
auth on
tls off
from user.name@domain.name
# the user name might be an account username, or your full email address
user user.name
password user.password

# ISP Mail Server Account
# Some ISPs provide you with access to a mail server
account MyISP
host smtp.myisp.server
#port 465
auth off
#tls on
#tls_starttls off
from user.name@myisp.com
# the user/password might or might not be required (some ISPs know your IP and give it access automatically)
# the user name might or might not be your ISP provided email address
user user.name
password user.password

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

# Hotmail Account
account Hotmail
host smtp.live.com
port 587
auth on
tls on
from my.email@hotmail.com
user my.email@hotmail.com
password mypassword 

# Yahoo Account
account Yahoo
host smtp.mail.yahoo.com
port 465
auth on
tls on
tls_starttls off
from my.email@yahoo.com
user my.email@yahoo.com
password mypassword

# Default account to use
account default : LocalMailServer

You’ll need to –

  • Edit the above to update the drive letter WampDeveloper Pro is installed on for the “logfile” line.
  • Update the account settings for the Gmail/Hotmail/Yahoo or SMTP (mail) server/service you are going to use.
  • Update account default : LocalMailServer with the account to use by default.

The above has been set up with a number of default settings for you, and in most cases you’ll just have to update a) your username/email + password, and b) the default account to use.

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

Uncomment (remove the “;”), and update the path (drive letter), on lines –

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"

Comment out “SMTP =” and “smtp_port =“. This way PHP’s mail() function is using the “sendmail” application, and not trying to establish it’s own mail server connection…

;SMTP = 127.0.0.1
;smtp_port = 25

4. Save edited files. Restart Apache for configuration changes to take effect.

Make sure your webapps and/or scripts are configured to use PHP’s mail() function, and not some specific sendmail path or SMTP server. Because this is what “msmtp” is for – getting those mail() calls, matching the “From:” address to one of the above accounts, establishing a connection using the account’s settings, and sending your mail via that account’s mail server.

This might require some testing before it starts to work perfectly, as 1) proper mail server settings are needed and 2) the PHP scripts/code you are using must be also using PHP’s mail() function with the proper Headers (From: xxx) included.

Once an email is sent, you’ll be able to see it in the email service’s “Sent” folder.

Be careful not to specify a fake From: address (which does not match your email address for the service) or your emails are going to be tagged as spam.

You’ll also have two log files that you can check –
C:\WampDeveloper\Tools\msmtp\msmtplog.txt
C:\WampDeveloper\Logs\Php\maillog.txt

5. Send test email…

<?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.';
?>

Running a Local SMTP server (not recommended)

Some options for SMTP/mail server applications are: hmailserver, mailenable, smartermail, or the native Windows Server SMTP service (* with this one, be careful not to also install and run IIS – which can prevent Apache from binding to port 80 and 443).

You’ll need to first update with your Registrar (domain register – GoDaddy, Namcheap, etc) the DNS records of your mail-server’s domain-names (smtp.your.domain.name) and their IP addresses. Your IPs must be static (can’t change from time to time). Otherwise, set up a local SMTP relay.

Configure the SMTP server to do no-authentication localhost access (PHP’s mail() function does not support authentication – it can only access a SMTP server, but it can not login using a username/password).

Keep the default php.ini settings:

SMTP = 127.0.0.1
smtp_port = 25

Comment out “sendmail_path =“. This way PHP’s mail() function establishes it’s own mail server connection, and doesn’t attempt to use the “sendmail” application.

You might also need to specify a proper “sendmail_from =” setting to match your email address.

Use an External SMTP service

Set it up to provide service for mail of your domain name. Make sure your domain’s DNS records reflect this service’s mail server names and IP addresses.

Then do the same thing as is option A. Or if your SMTP service allows no-authentication login via a white-listing of your IP, then just fill in the php.ini settings as in option B except with the IP and Port this service provides.

Use PHPMailer script

PHPMailer is able to send mail via an SMTP host such as 1) your local or external mail server (gmail), 2) sendmail (and qmail), and 3) PHP’s mail() function.

If using the mail() option, you can integrate PHPMailer with MSMTP (* and also if using the “sendmail” option with some more work).

* This assumes your code/scripts are able to utilize something other than the PHP mail() function.

Examples can be found here:
http://phpmailer.worxware.com/index.php?pg=examples
https://github.com/PHPMailer/PHPMailer/tree/master/examples

Download and unzip PHPMailer as –
C:\WampDeveloper\Tools\PHPMailer

Then start using it:

<?php
require('C:/WampDeveloper/Tools/PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
...
?>

Other Alternatives

Fake Sendmail:

sendmail.exe is a simple windows console application that emulates sendmail's "-t" option to deliver emails piped via stdin.

It is intended to ease running unix code that has /usr/lib/sendmail hardcoded as an email delivery means.

It doesn't support deferred delivery, and requires an smtp server to perform the actual delivery of the messages.

Adding Websites

To create a new website:

1. In the Websites Tab, click button: Create New Website.

wamp-dev-websites-new

2. Enter into the “Primary Domain Name” field the domain-name you would like to use:
www.example.com

In the “Domain Aliases” field enter any other domain aliases for your website:
example.com, www.example.org, example.org, www.example.net, example.net

It is perfectly okay to use an un-registered, fake, or an already taken (registered) domain-name. The LocalDNS feature of Wamp-Developer Pro will enable this domain-name to work (…to resolve to the local IP 127.0.0.1) immediately in the Browser of your local system.

You may also add an IP address into the Domain Aliases field to be able to access this website directly via an IP address URL (such as http://127.0.0.1/). You can locate your system’s local LAN IP, public IP, and also the system’s host-name (LAN’s “domain-name” for your system) in Wamp-Developer’s System Tab.

Unless you de-select “Forward to Primary Domain: All Aliases”, all domain aliases requests that reach this website will be re-directed automatically to the Primary Domain Name in the user’s Browser.

Unless you de-select “Forward to Primary Domain: SSL”, all HTTPS (SSL) requests that reach this website will be re-directed automatically to the HTTP (non-SSL) URL in the user’s Browser.

3. Click Continue.

wamp-dev-websites-continue

A few seconds later, your Website should show up in the Websites list, and its State should be listed as: Added.

Selecting the new website in the list and clicking the DocumentRoot button will open this website’s folder (the DocumentRoot folder). File index.php (or index.html) is the file displayed by default when going to the website’s URL (address).

Double-clicking the website entry or clicking the Website button will open this website in your default Browser.

Notes:

Folder C:\WampDeveloper\Websites\domain.name\certs\ holds the website’s SSL Private Key (private.key) and Public Certificate (public.crt) files. The initial files placed here (when adding a website) are self-signed placeholder files that will result in Browser warnings. These placeholders will eventually need to be replaced with a legitimate key and certificate file.