简体   繁体   English

在httpd.conf中更改DocumentRoot后,XAMPP上的PHPMyAdmin和Security无法正常工作

[英]PHPMyAdmin and Security on XAMPP not working after changing DocumentRoot in httpd.conf

SUMMARY 摘要

I am unable to run localhost/phpadmin and localhost/security after changing the DirectoryRoot in XAMPP httpd.conf. 在XAMPP httpd.conf中更改DirectoryRoot后,我无法运行localhost / phpadmin和localhost / security。 This leads to two questions. 这导致两个问题。

  1. If I am using XAMPP on Windows, is there any way to run PHP files outside the localhost directory that I have set in the httpd.conf? 如果我在Windows上使用XAMPP,是否有任何方法可以在我在httpd.conf中设置的localhost目录之外运行PHP文件?

  2. If "no", then how does one run files such as phpmyadmin or the security module on the local machine, if the phpmyadmin files reside in the c:\\xampp directory but the DocumentRoot path in httpd.conf points to a different directory? 如果为“否”,那么如果phpmyadmin文件位于c:\\ xampp目录中,但httpd.conf中的DocumentRoot路径指向另一个目录,那么如何在本地计算机上运行诸如phpmyadmin或安全模块的文件?

More detail is set out below. 下面列出了更多细节。

BACKGROUND INFO 背景资料

My installation is as follows. 我的安装如下。

  • Operating system: Windows 7 作业系统:Windows 7
  • Version of XAMPP: xampp-portable-lite-win32-1.8.1-VC9.7z XAMPP的版本: xampp-portable-lite-win32-1.8.1-VC9.7z
  • Installation directory: c:\\xampp-portable 安装目录: c:\\xampp-portable
  • Code files saved in: d:\\dropbox\\websites_user1\\... 代码文件保存在: d:\\dropbox\\websites_user1\\...

I then modified the httpd.conf as follows: 然后,我将httpd.conf修改如下:

Line 191: DocumentRoot "D:/Dropbox/websites_user1"
Line 222: <Directory "D:/Dropbox/websites_user1">

The default httpd-xampp.conf configuration is unchanged - eg: 默认的httpd-xampp.conf配置未更改-例如:

Line 99:  Alias /phpmyadmin "/xampp-portable/phpMyAdmin/"
Line 100: <Directory "/xampp-portable/phpMyAdmin">
Line 121: <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">

THE PROBLEM 问题

After changing the directory root in httpd.conf as above, I can run php files successfully from local host - eg localhost/project01/demo.php. 如上更改httpd.conf中的目录根目录后,我可以从本地主机成功运行php文件-例如localhost / project01 / demo.php。

However, I now can't run PHP files from any location other than those located in the new localhost directory (ie d:/Dropbox/websites_user1/..). 但是,我现在无法从新本地主机目录(即d:/ Dropbox / websites_user1 / ..)以外的任何位置运行PHP文件。 This means that I can no longer run PHP files in locations such c:\\xampp\\PHPMyAdmin or C:\\xampp-portable\\security\\htdocs\\security.php. 这意味着我不能再在c:\\ xampp \\ PHPMyAdmin或C:\\ xampp-portable \\ security \\ htdocs \\ security.php等位置运行PHP文件。

Also, the configuration for the PHPMyAdmin and Security are clearly no longer correct. 同样,PHPMyAdmin和安全性的配置显然不再正确。 For instance, if I enter "localhost/phpmyadmin" or "localhost/security", I get a "page not found" error. 例如,如果我输入“ localhost / phpmyadmin”或“ localhost / security”,则会收到“找不到页面”错误。

This leads to two sets of questions (as summarised at the start of this question). 这导致了两套问题(如本问题开头所述)。

  1. Is the directory configured as the localhost the ONLY location from which PHP files can be run? 该目录是否配置为localhost是可以运行PHP文件的唯一位置? Is it possible to configure PHP to run from any location on my C or D drives? 是否可以将PHP配置为从C或D驱动器上的任何位置运行?

  2. If not, how do I run files such as those in PHPMyAdmin or security.php or any of the innumerable files in the other xampp directories? 如果没有,如何运行诸如PHPMyAdmin或security.php中的文件或其他xampp目录中无数的文件? Do I need to copy and paste the phpmyadmin folder into my localhost folder at D:/Dropbox/websites_user1? 我是否需要将phpmyadmin文件夹复制并粘贴到位于D:/ Dropbox / websites_user1的localhost文件夹中? Or into each of the individual website folders beneath that? 还是进入下面的每个网站文件夹? If yes, do I then need to reconfigure any files such as http-xampp.conf? 如果是,我是否需要重新配置任何文件,例如http-xampp.conf?

I am relatively new to PHP and new to XAMPP. 我对PHP和XAMPP相对较新。 Everything was working perfectly until I ran into this ... and now I'm completely stuck if I can't use PHPMyAdmin, and can't even use the Security module to set my passwords. 在碰到这个问题之前,一切都运转良好。现在,如果我无法使用PHPMyAdmin,甚至无法使用安全性模块来设置密码,那么我将完全陷入困境。

Will be very grateful for advice!! 将非常感谢您的咨询!!

I believe you cant run anything higher than your root as a security feature. 我相信,作为一项安全功能,您不能运行比您的根更高的任何产品。 Imagine some remote person knowing your IP address and accessing all your files above your document root. 想象一下某个远程人员知道您的IP地址并访问文档根目录上方的所有文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM