Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: mike652638 (119.129.84.---)
Date: March 20, 2019 11:37AM

Hi, I'm attempting to create two virtual hosts test.com and demo.com, and achieve the goal:

1). test.com, www.test.com, and localhost:8010 all directs to C:/Wamp/www/test/
2). demo.com, www.demo.com, and localhost:8020 all directs to C:/Wamp/www/demo/
And yes, they are working as expected when tested in browsers.

My questions is why in the bottom of WAMPSERVER Hompage, it still shows me following errors:
YOUR VIRTUALHOST
localhost - Not a Listen port
test.com - Not a Listen port
test.com:8010 - Not a Listen port
demo.com:80 *:8020 - Not a Listen port
Error(s) See below
Port used for the VirtualHost is not an Apache Listen port
Port number for <VirtualHost *:port> has not correct value or is not the same in file C:/Wamp/bin/apache/apache2.4.37/conf/extra/httpd-vhosts.conf

Below are my answers to READ-BEFORE-ASK:
1 - Windows version used - Win10 1809 64Bit with the latest patches;
2 - Version WampServer - 3.1.7 64Bit
3 - Apache Version - 2.4.37
4 - PHP Version - 7.1.26
5 - MySQL Version - 5.7.24
5a - MariaDB version if applicable -10.3.12
6 - What color is the WampServer icon - Green
7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines?
127.0.0.1 localhost
::1 localhost
127.0.0.1 test.com
127.0.0.1 www.test.com
127.0.0.1 demo.com
127.0.0.1 www.demo.com
8 - Do you have access to localhost (Homepage WampServer)? - Yes
8a - If so, is there an error message at the bottom of the page? - Yes, errors shown are as said above
9 - Do you have access to phpMyAdmin? - Yes
10 - If you refer to an error message, please include the EXACT wording of the error in your post - Yes, errors shown are as said above
11 - If you use an Antivirus and / or Firewall, please include the names of these - Having tried to close all firewalls/antivirus when start, errors still show;
12 - What is the full path to the installation of WampServer (eg D:\wamp\) - C:\Wamp
13 - If you have one or more Virtual Hosts defined, please show their definition(s)
Listen 80
Listen 8010
Listen 8020

<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/Wamp/www"
<Directory "C:/Wamp/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
#Require local
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
DocumentRoot "C:/Wamp/www/test"
<Directory "C:/Wamp/www/test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:8010>
ServerName test.com
ServerAlias www.test.com
DocumentRoot "C:/Wamp/www/test"
<Directory "C:/Wamp/www/test/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

<VirtualHost *:80 *:8020>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Additional info might help:
14 - Window Key+R=>CMD>netstat -aon|findstr "80" => PID LISTEING 7912
CMD>tasklist|findstr "2720" => httpd.exe 7912 Services 0 21,152 K
The same goes with port 8010, 8020
15 - Any other versions of Wampserver installed ? - No
16 - XAMPP installed ? - No
17 - Windows IIS Enabled ? - No
18 - Skype (App) Installed - No
19 - All Visual C++ Packages required installed ? - Yes, I have downloaded and installed all packages(Both X86 && X64) from [wampserver.aviatechno.net], the tool Checks VC++ packages installed also shows: All packages are installed corretly ...
20 - Have searched similar problem in forum.wampserver.com, ServerFault, StackOverFlow, etc ? - Yes, but haven't found a solution yet;

Thanks for your attention and analysis, further info will be replied per request smiling smiley

Best Regards, Mike

Options: ReplyQuote
Re: Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: RiggsFolly (Moderator)
Date: March 20, 2019 12:08PM

Hi

Did you use the Tools-> Add a Listen Port for Apache

menu to tell WAMPServer that you wanted to use other ports?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.0 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.19>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: mike652638 (113.66.40.---)
Date: March 20, 2019 01:56PM

Hi RiggsFolly,

Yes I tried "Tools-> Add a Listen Port for Apache" many times, when I add 80, it says:
The port number you give: 80
is not valid or already used or is default port

But when I add 8010, 8020, etc (Other than 80), a cmd window just flashes and then closed quickly (without messages or pause), the wampserver icon turned orange, then green. After which, nothing seems to change, the errors still show even if I restart DNS, restart Wampserver, totally clean browser cache, restart computer...

Moveover, Tools-> Test Port 80, it shows below:

***** Test which uses port 80 *****

===== Tested by command netstat filtered on port 80 =====


Test for TCP
Your port 80 is used by a processus with PID = 13152
The processus of PID 13152 is 'httpd.exe' Session: Services
The service of PID 13152 for 'httpd.exe' is 'wampapache64'
This service is from Wampserver - It is correct

Test for TCPv6
Your port 80 is used by a processus with PID = 13152
The processus of PID 13152 is 'httpd.exe' Session: Services
The service of PID 13152 for 'httpd.exe' is 'wampapache64'
This service is from Wampserver - It is correct

===== Tested by attempting to open a socket on port 80 =====

Your port 80 is actually used by :

Server: Apache/2.4.37 (Win64) PHP/7.1.26

Tools-> Use a port other than 80, choose 8010, it's ok with [localhost] to show WAMPSERVER Homepage, while in the bottom, the same errors still show. So I changed back to use port 80.

Options: ReplyQuote
Re: Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: Otomatic (Moderator)
Date: March 20, 2019 07:00PM

Hi,

I not possible to explain how to use a listen port added because I am not at home till sunday and it is not very easy to write long explanations with a Smartphone.

You need to firstlyz add à listen port then add a VirtualHost using this port. This must not be done manually but only with Wampserver tools.

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.4 32 bit - Apache 2.4.46a - PHP 8.0.0…5.6.40 - MySQL 5.7.32 - MariaDB 10.5.8
Wampserver 3.2.4 64 bit - Apache 2.4.46a - PHP 8.0.0…5.6.40 - MySQL 5.7.32/8.0.22 - MariaDB 10.5.8
PhPMyadmin 5.0.4 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote
Re: Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: mike652638 (119.129.84.---)
Date: March 21, 2019 12:17PM

Hi,

After a complete uninstall and reinstall, I tried again "Tools-> Add a Listen Port for Apache" from scratch, during which I was watching what happened indeed after this process:

1. Tools-> Add a Listen Port for Apache -> 8010;
1-1. A cmd window just flashes and then closed quickly (without messages or pause), the wampserver icon turned orange, then green.
1-2. In the file C:\Wamp\bin\apache\apache2.4.37\conf\httpd.conf, two new rows were found to be inserted automaticly:
Define MYPORT8010 8010 (Line 48 or so)
Listen 0.0.0.0:${MYPORT8010} (Line 72 or so)
1-3. After a restart of wampserver and then a refresh of WAMPSERVER Homepage, in the Server Configuration Section, the second line:
Server Software: Apache/2.4.37 (Win64) PHP/7.1.26 - Port defined for Apache: 80 - 8010 (Note 8010 newly added here)
2. Then comes to the file C:\Wamp\bin\apache\apache2.4.37\conf\extra\httpd-vhosts.conf:
2-1: The first try (Restart of wampserver and then refresh of WAMPSERVER Homepage each time):
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80 *:8010>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

In the bottom of WAMPSERVER Homepage, there are errors showing:
Your VirtualHost
localhost
demo.com:80 *:8010 - Not a Listen port
Error(s) See below
Port :80 *:8010 used for the VirtualHost is not an Apache Listen port
Port number for <VirtualHost *:port> has not correct value or is not the same in file C:/Wamp/bin/apache/apache2.4.37/conf/extra/ httpd-vhosts.conf

2-2: The second try:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:8010>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

In the bottom of WAMPSERVER Homepage, there are errors showing:
Your VirtualHost
localhost
demo.com
demo.com:8010 - Not a Listen port
Error(s) See below
Port :8010 used for the VirtualHost is not an Apache define variable

2-3: The third try:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

<VirtualHost *:${MYPORT8010}>
ServerName demo.com
ServerAlias www.demo.com
DocumentRoot "C:/Wamp/www/demo"
<Directory "C:/Wamp/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

In the bottom of WAMPSERVER Homepage:
Your VirtualHost
localhost
demo.com
demo.com:8010

As you see, FINNALLY no errors are shown in the bottom !

3. My further tests and conclusions are as below (Kindly point out if any):

3-1. In httpd.conf, can we REPLACE
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
Listen 0.0.0.0:${MYPORT8010}
Listen [::0]:${MYPORT8010}

WITH

#Listen 12.34.56.78:80
Listen 80
Listen ${MYPORT8010}

OR EVEN

#Listen 12.34.56.78:80
Listen 80
Listen 8010

?

The Answer: NO ! There will be errors shown in the bottom of WAMPSERVER Homepage:
Your VirtualHost
localhost - Not a Listen port
demo.com - Not a Listen port
demo.com:8010 - Not a Listen port
Error(s) See below
Port used for the VirtualHost is not an Apache Listen port

3-2. Can we MOVE (By move we mean "CUT"winking smiley,
#Listen 12.34.56.78:80
Listen 0.0.0.0:80
Listen [::0]:80
Listen 0.0.0.0:${MYPORT8010}
Listen [::0]:${MYPORT8010}

FROM httpd.conf TO httpd-vhosts.conf (With following line in httpd.conf UNCOMMENTED of course: Include conf/extra/httpd-vhosts.conf)

?

The Answer: NO ! There will be same errors shown in the bottom of WAMPSERVER Homepage just as 3-1.


HOWEVER, just like the very beginning of my post, with any of these configs [2-1, 2-2, 2-3, 3-1, 3-2], the Wampserver Icon can turn green, and it just works as expected to open and visit the urls in browsers: localhost, localhost:80, localhost: 8010, demo.com, www.demo.com, www.demo.com:8010 and so on.

SO, do you think the "Not a Listen port" errors in the above situations are Wrongly or Unnecessarily shown in WAMPSEVER Homepage ?
Would you mind to check the lines 189-202 in www/index.php file ?

$UrlPortVH = ($virtualHost['ServerNamePort'][$value] != '80') ? ':'.$virtualHost['ServerNamePort'][$value] : '';
if(!$virtualHost['port_listen'] && $virtualHost['ServerNamePortListen'][$value] !== true || $virtualHost['ServerNamePortApacheVar'][$value] !== true) {
$value_url = ((strpos($value, ':') !== false) ? strstr($value,':',true) : $value);
$vhostsContents .= '<li>'.$value_url.$UrlPortVH.' - <i style="color:red;">Not a Listen port</i></li>';
if($virtualHost['ServerNamePortListen'][$value] !== true)
$msg_error = ' not an Apache Listen port';
elseif($virtualHost['ServerNamePortApacheVar'][$value] !== true)
$msg_error = ' not an Apache define variable';
if(!$vhostError) {
$vhostError = true;
$vhostErrorCorrected = false;
$error_message[] = "Port ".$UrlPortVH." used for the VirtualHost is ".$msg_error;
}
}

Thanks for your patience smiling smiley

Best Regards,
Mike



Edited 1 time(s). Last edit at 03/21/2019 12:33PM by mike652638.

Options: ReplyQuote
Re: Wampserver Homepage Shows Error "Port used for the VirtualHost is not an Apache Listen port" ...
Posted by: Jose Maria (---.prod-infinitum.com.mx)
Date: October 23, 2020 07:49AM

It worked for me,

thanks

Options: ReplyQuote


Sorry, only registered users may post in this forum.