[英]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
在查看了有關堆棧溢出的其他問題后,我現在可以通過 LAN 上的任何設備訪問 www 文件夾或 www/project1 文件夾中的 index.htm。
但是,index.php 僅適用於本地計算機。 嘗試通過 LAN 訪問另一台設備上的 index.php 時,會顯示以下消息:
“無法訪問此站點
localhost 拒絕連接。
嘗試:
檢查連接 ERR_CONNECTION_REFUSED"
這是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>
請指教。 謝謝。
更新:
具有以下代碼的 index.php 確實有效:
<?php
// program to tell php version using ftp/sftp client
phpinfo();
?>
但是我的網站 index.php 有效:
<?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();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.