PHP   发布时间:2022-04-09  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何在我的本地PHP开发人员设置中设置DOCUMENT_ROOT和站点根目录?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在网上做一个网站的工作.这是一个外星人的网站,我正在慢慢地通过奇怪的代码.@L_350_3@mAMP本地,我的 http://localhost/有许多客户端文件夹从中脱离出来.在这代码中有很多$_SERVER [‘document_root’]命令和引用,这些命令和引用只是在我的本地PHP开发区域中丢失.

如何轻松地将document_root的引用设置为应该是什么(在本地,尽管如此,不要真的想弄乱网站文件,因为我需要再次上传它们,不想破坏实况网站!是否有一种间接设置的方式,PHP认为网站的根源是这样的图像的src引用“/ images / …”将正确显示…我的本地PHP开发网址是:http://localhost:8888/_CLIENTS/clientsite/www/ …但是在代码中’/’开头的’/ images / …’引用了http://localhost:8888/

谢谢.

@H_673_6@
我建议的是vhosts,所以您可以在本地提供“外来站点”,而不会影响您的认Web服务器.

> localhost – >你的起始页或者什么
> alien.localhost – >客户端站点,无论您想要的路径/文档根目录.
> x.localhost – >另一个网站

在apaches全局配置文件或包含vhost.conf;

NameVirtualHost localhost:80
# the MysqL tool's url
<VirtualHost @L_987_8@myadmin.localhost:80>
# and absolute path
DocumentRoot "/srv/www/@L_987_8@myAdmin/"
</VirtualHost>

#Same for the Client Site
<VirtualHost foo.localhost:80>
DocumentRoot "/path/to/desired/webroot/"
</VirtualHost>

您可以通过首先指定以下内容来控制权限并设置整体全局站点

在apache的全局服务器配置

DocumentRoot "/srv/www/htdocs"
#
# Configure the DocumentRoot Properties
#
<Directory "/srv/www/htdocs"> 
    Options All
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All","None",or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride All
    # Controls who can get stuff from this server.
    Order allow,deny
    Allow from all
</Directory>
#
# Configure Sub-Domain Properties. This prevents those nasty 403 errors
#

# MysqL administration tool
<Directory "/srv/www/@L_987_8@myAdmin/">
    Options Indexes MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

# a client web site built with CakePHP
<Directory "/home/eddie/workspace/Digital_Business/app/webroot/">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

大佬总结

以上是大佬教程为你收集整理的如何在我的本地PHP开发人员设置中设置DOCUMENT_ROOT和站点根目录?全部内容,希望文章能够帮你解决如何在我的本地PHP开发人员设置中设置DOCUMENT_ROOT和站点根目录?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。