check_virtualhost( ) in the wampserver.lib.php raises errors
Posted by: WAMP64user (---.north.dsl.telkomsa.net)
Date: March 31, 2020 08:24PM

Hi Guys,

The issue is presented based on the 13 questions.

1 – Windows version used (Specify version number AND whether 32 or 64 bit)
Windows 10 X64, Single Language (Build 18362)

2 – Version WampServer (Specify version number AND whether 32 or 64 bit)
WampServer 3.2.0 X64

3 – Apache Version
Apache 2.4.41

4 – PHP Version
PHP Version 7.4.4

5 – DBMS
5a - MySQL version if applicable – Not Installed.
5b - MariaDB version if applicable – MariaDB version 10.4.12.

6 - What color is the WampServer icon (in the notification area of the taskbar) When all goes well it should be green, but it may be red or orange.
The icon is green.

The following is not applicable because the icon is green..

If the WampServer icon is NOT GREEN please ensure you have looked at these files :-
a - Apache logs
-- ( wampmanager -> Apache -> Apache error log )
-- ( wampmanager -> Apache -> Apache access log )
b1 - MySQL error log ( wampmanager -> MySQL -> MySQL log )
b2 - MariaDB error log ( wampmanager -> MariaDB -> Mariadb log )
c - PHP error log ( wampmanager -> PHP -> PHP error log )

Depending on the error, one or all of the above may be empty so also look at
d - The windows event viewer
--- Windows Key + R to launch the run dialogue then enter eventvwr.exe and press the OK button
--- - On the left side of the windows click 'Windows Logs -> Applications'
--- - Look for the names 'Apache Service' or 'MySQL' in the Source column which have an error symbol in the first column.

If you find any errors that you cannot fix for yourself please post the COMPLETE EXACT error message in your question.


7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines?
* Active means no # at the beginning of the line.


If the WampServer icon is green:

8 - Do you have access to localhost (Homepage WampServer)?
Yes, I can access localhost homepage.
8a - If so, is there an error message at the bottom of the page?
There is not error at the bottom. However, there are errors before the page is displayed. The following batch of errors are raised twice:
Notice: Undefined index: ServerName in D:\wamp64\scripts\wampserver.lib.php on line 715
Notice: Undefined index: DocumentRoot in D:\wamp64\scripts\wampserver.lib.php on line 716
Notice: Undefined index: Port in D:\wamp64\scripts\wampserver.lib.php on line 717
Notice: Undefined index: Port in D:\wamp64\scripts\wampserver.lib.php on line 718

Note:
According to the call stack the errors were raised in the check_virtualhost( ) function in the wampserver.lib.php after the function was called in index.php on line 156.

9 - Do you have access to phpMyAdmin?
Yes, I can access phpMyAdmin 5.0.2.1
10 - If you refer to an error message, please include the EXACT wording of the error in your post
Please refer to point 8a above.

11 - If you use an Antivirus and / or Firewall, please include the names of these
ESET Internet Security 13.1.16.0

12 - What is the full path to the installation of WampServer (eg D:\wamp\)
d:\wamp64\

13 - If you have one or more Virtual Hosts defined, please show their definition(s)

I included both Vhosts and SSL definitions.

I believe the the errors are raised by the three directory definitions in testsite2.dz


############ Definitions ############

#---------------------------------- localhost ----------------------------------#

ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"

# Per host logging
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" VirtualHostComonLog
ErrorLog "${SRVROOT}/logs/localhost-error.log"
CustomLog "${SRVROOT}/logs/localhost-access.log" VirtualHostComonLog

# Directory Options
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

#---------------------------------- testsite1.dz ----------------------------------#

<VirtualHost *:80>
ServerName testsite1.dz
ServerAlias www.testsite1.dz
DocumentRoot "d:/wamp64/www/vhosts/testsite1.dz/wwwroot/"

# Per host logging
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" VirtualHostComonLog
ErrorLog "${SRVROOT}/logs/testsite1.dz-error.log"
CustomLog "${SRVROOT}/logs/testsite1.dz-access.log" VirtualHostComonLog

# Directory Options
<Directory "d:/wamp64/www/vhosts/testsite1.dz/wwwroot/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Require ip 192.168.1.1/28 192.168.0.1/28
</Directory>
</VirtualHost>

#---------------------------------- testsite2.dz ----------------------------------#

<VirtualHost *:80>
ServerName testsite2.dz
ServerAlias www.testsite2.dz
DocumentRoot "d:/wamp64/www/vhosts/testsite2.dz/wwwroot/"

# Per host logging
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" VirtualHostComonLog
ErrorLog "${SRVROOT}/logs/testsite2.dz-error.log"
CustomLog "${SRVROOT}/logs/testsite2.dz-access.log" VirtualHostComonLog

# Directory Options
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot">
AllowOverride FileInfo
Require all granted
Require ip 192.168.1.1/28 192.168.0.1/28
</Directory>
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot/sites">
AllowOverride None
</Directory>
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot/sites/default/documents">
Require all denied
</Directory>
</VirtualHost>

############ SSL Definitions ############

#---------------------------------- testsite1.dz ----------------------------------#

<VirtualHost *:443>
DocumentRoot "d:/wamp64/www/vhosts/testsite1.dz/wwwroot/"
ServerName testsite1.dz:443
ServerAdmin admin@testsite1.dz

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on

# SSl Setup
SSLCertificateFile "d:/wamp64/bin/apache/apache2.4.41/conf/ssl.crt/testsite1.crt"
SSLCertificateKeyFile "d:/wamp64/bin/apache/apache2.4.41/conf/ssl.key/testsite1.key"

# Logging
ErrorLog "${SRVROOT}/logs/testsite1.dz-error.log"
TransferLog "${SRVROOT}/logs/testsite1.dz-access.log"
CustomLog "${SRVROOT}/logs/testsite1.dz-ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

# Directory Options
<Directory "d:/wamp64/www/vhosts/testsite1.dz/wwwroot/">
# SSLOptions +StdEnvVars
Options ExecCGI FollowSymLinks Includes Indexes
AllowOverride All
Require all granted
Require ip 192.168.1.1/28 192.168.0.1/28
</Directory>
</VirtualHost>

#---------------------------------- testsite2.dz ----------------------------------#

<VirtualHost *:443>
DocumentRoot "d:/wamp64/www/vhosts/testsite2.dz/wwwroot/"
ServerName testsite2.dz:443
ServerAdmin admin@testsite2.dz

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on

# SSl Setup
SSLCertificateFile "d:/wamp64/bin/apache/apache2.4.41/conf/ssl.crt/testsite2.crt"
SSLCertificateKeyFile "d:/wamp64/bin/apache/apache2.4.41/conf/ssl.key/testsite2.key"

# Logging
ErrorLog "${SRVROOT}/logs/testsite2.dz-error.log"
TransferLog "${SRVROOT}/logs/testsite2.dz-access.log"
CustomLog "${SRVROOT}/logs/testsite2.dz-ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

# Directory Options
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot">
AllowOverride FileInfo
Require all granted
Require ip 192.168.1.1/28 192.168.0.1/28
</Directory>
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot/sites">
AllowOverride None
</Directory>
<Directory "D:/wamp64/www/vhosts/testsite2.dz/wwwroot/sites/default/documents">
Require all denied
</Directory>
</VirtualHost>

Help to resolve the issue will be appreciated.

Options: ReplyQuote
Re: check_virtualhost( ) in the wampserver.lib.php raises errors
Posted by: Otomatic (Moderator)
Date: March 31, 2020 08:43PM

Hi,

Considering your httpd.conf file, you are almost a professional.
WAMPServer is mainly a LEARNING TOOL, so that people can learn and try to take over a server.
The VirtualHost checks are again for simple VirtualHost, in the same style as the original localhost VirtualHost, to learn.

You can disable these tests by :
Clic-Droit -> Wamp settings -> Don't check VirtualHost definitions

And, since only the httpd-vhosts.conf file is tested, you leave only the VirtualHost localhost definition in that file and put all your definitions in another myhttpd-vhosts.conf file which you call an include in the httpd-vhosts.conf file.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: check_virtualhost( ) in the wampserver.lib.php raises errors
Posted by: WAMP64user (---.north.dsl.telkomsa.net)
Date: April 01, 2020 06:46AM

Otomatic, Thank you my good Sir your time, effort and commitment is appreciated.

Options: ReplyQuote
Re: check_virtualhost( ) in the wampserver.lib.php raises errors
Posted by: Dragos (---.workpage.ro)
Date: June 16, 2022 09:39AM

Otomatic Wrote:
-------------------------------------------------------

> And, since only the httpd-vhosts.conf file is
> tested, you leave only the VirtualHost localhost
> definition in that file and put all your
> definitions in another myhttpd-vhosts.conf file
> which you call an include in the httpd-vhosts.conf
> file.

Hi.
How can i do httpd-vhosts.conf to include myhttpd_vhosts.conf file?
Sorry im not programmer...
Thank you.

Options: ReplyQuote
Re: check_virtualhost( ) in the wampserver.lib.php raises errors
Posted by: Otomatic (Moderator)
Date: June 16, 2022 09:46AM

Hi,

RTFM -> Include

I would like to point out that there is a link to the Apache documentation in :
Left-click -> Apache -> Apache documentation

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.