'wampserver php site only works on local machine (index.htm works on all devices over LAN)

Wampserver PHP 7.4.26 , Apache 2.4.51, mysql 8.0.27

Having looked at other questions on stack overflow I am now able to access index.htm in www folder or www/project1 folder via any device on LAN.

However, index.php only works on local machine. When trying to access index.php on another device over LAN, the following message is indicated:

"This site can’t be reached

localhost refused to connect.

Try:

Checking the connection ERR_CONNECTION_REFUSED"

Here is httpd-vhosts.conf:



# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>



<VirtualHost *:80>
    ServerName famtree
    ServerAlias www.tree
    DocumentRoot "c:/wamp64/www/tree"
    <Directory  "c:/wamp64/www/tree/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

Please advise. Thanks.

Update:

An index.php with the following code does work:

    <?php
    // program to tell php version using ftp/sftp client
     phpinfo();
    ?>

However my website index.php dosent work:

    <?php

/**
 * webtrees: online genealogy
 * Copyright (C) 2022 webtrees development team
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 */

declare(strict_types=1);

namespace Fisharebest\Webtrees;

use function is_file;
use function is_string;
use function parse_url;

use const PHP_SAPI;
use const PHP_URL_PATH;

require __DIR__ . '/vendor/autoload.php';

if (PHP_SAPI === 'cli-server') {
    $file = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
    if (is_string($file) && is_file($file)) {
        return false;
    }
}

// @see https://github.com/briannesbitt/Carbon/issues/2536
$file = '/vendor/symfony/translation/TranslatorInterface.php';
if (file_exists(__DIR__ . $file) && !unlink(__DIR__ . $file)) {
    echo 'Please delete the file ' . $file;
    return;
}

$webtrees = new Webtrees();
$webtrees->bootstrap();

if (PHP_SAPI === 'cli') {
    $webtrees->cliRequest();
} else {
    $webtrees->httpRequest();
}



Solution 1:[1]

I found out where I went wrong:

https://www.webtrees.net/index.php/en/forum/help-for-release-2-1-x/36924-accessing-webtrees-on-devices-over-lan-via-wamp-server

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 BVS