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

编程知识 行业动态 更新时间:2024-06-13 00:22:55

在初学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/qq_27542641/article/details/77076254

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

 

更多推荐

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

本文发布于:2023-04-03 13:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/e4cffdab5d0e27ca9cd4e0d50cb22c37.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:URL   requested   test   server   php

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!