The requested URL /test.php was not found on this server

在初学PHP中遇到两个问题,The requested URL /test.php was not found on this server 和You don't have permission to access / on this server.  搜索了很多博客,下面这个博客可以解决问题:

WampServer自定义网站根目录

 

D盘新建了Demo文件夹(设定的网站根目录),新建文本test.php,拓展名改为.php

输入以下内容,如果成功,则输出success。

 

 
  1. <?php

  2. echo "success";

  3. ?>

 

 

浏览器中输入要访问的地址:localhost/test.php,出现以下结果:

 

Not Found

 

The requested URL /test.php was not found on this server.


Apache/2.4.23 (Win64) PHP/5.6.25 Server at localhost Port 80

 

需要配置一下apache里面的配置文件:

httpd.conf   和  httpd.vhosts.conf

 

 

打开后,搜索DocumentRoot更改路径

${INSTALL_DIR}/www/  和  c:/wamp64/www/  改为d:/Demo(设定的网站根目录)

重新启动所有服务,就能够访问了

 

同时,要更改安装包下面的wampmanager.ini 和wampmanager.tpl配置。

 

搜索Menu.left,

1、wampmanager.ini下把www 目录对应的filename改为自定义目录

2、wampmanager.tpl下把${w_wwwDirectory}对应的filename改为自定义目录

 

退出、重启服务器,www目录变成了Demo目录,不过是乱码

点开后就转到了D盘的Demo文件夹

原文地址:https://blog.csdn.net/qq_27542641/article/details/77076254

在编写PHP文件时把PHP文件放到上面那个目录下,运行时在浏览器搜索栏输入:localhost/文件名.php

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值