Warning: Invalid argument supplied for foreach() in C:\wamp64\www\add_vhost.php on line 1065
Posted by: DJMarvin54 (---.us-east-2.compute.amazonaws.com)
Date: August 28, 2022 04:12PM

I am trying to set up a WordPress site on my PC but haven't been able to. I have done the WP install many times without any issues but am now running into one snag after another. I must be doing something wrong but don't know what that is. I went through my system and followed instructions from this forum to remove all virtual hosts and all WP files, etc. I thought I had everything set up correctly and tried to setup a new virtual host. I got this warning and the set up stopped:

Warning: Invalid argument supplied for foreach() in C:\wamp64\www\add_vhost.php on line 1065

1. Even though the "W" is green, is it possible that my instance of WAMPServer is corrupt and needs to be reinstalled?

2. If I need to reinstall WampServer, what is the correct process to follow? (I couldn't find any instructions when I searched the forum.)

I followed all the pre-install instructions for installing WampServer. I verified that all the MS Windows Visual C++ Packages are installed.

I don't recall whether I installed WAMPServer as administrator. My user role is set as "Administrator" but I believe I have to specify "Run as Administrator" when I run the setup. I just don't recall doing this.

Here are my answers to the questions about my setup:

1 - Windows version used: Windows 11 Pro Version 21H2 64-bit

2 - Version of WampServer: 3.2.9 64 bits

3 - Apache Version: Apache 2.4.46 Port 80

4 - PHP Version: PHP 7.4.9

5 - PHP 5.6.40 for CLI (Command-Line Interface)

5 - MySQL Version: MySQL 5.7.31 Port 3306

5a - MariaDB version if applicable: Not applicable

6 - What color is the WampServer icon: Green

Options: ReplyQuote
Re: Warning: Invalid argument supplied for foreach() in C:\wamp64\www\add_vhost.php on line 1065
Posted by: Otomatic (Moderator)
Date: August 28, 2022 04:45PM


You can reinstall the 3.2.9 update several times in a row without any problem, but before that it is necessary to :

- Verify that all VC ++ packages are installed and with the latest versions.
To do this, use the tool:
Checks VC++ packages installed
Do not use a previously loaded tool. Make a new download to make sure you are using the correct version.
To download missing packages, do not rely on Microsoft links, they are not reliable, download packages on http://wampserver.aviatechno.net in section Visual C++ Redistribuable Packages
Do not forget that if you have a 64 bit Windows, you must install both 32 and 64 bit versions of each package.
You must install each package "as an administrator", so right-click the exe file and then run as Administrator.

- Apply Update 3.2.9 to your version of Wampserver
Wampserver update 3.2.9

Apache 2.4.46 and php 7.4.9 are very old. Install Apache 2.5.54 and PHP 7.4.30 addons then switch to these versions.

Remember that the VirtualHost must exist before installing WordPress.
Why to create a VirtualHost BEFORE installing a CMS

Wampserver 3.2.10 32 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.10 64 bit - Apache 2.4.54 - PHP 8.2.0…5.6.40 - MySQL 5.7.39/8.0.30 - MariaDB 10.5.17/10.9.2
PhPMyadmin 5.2.0 - 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

Sorry, only registered users may post in this forum.