简体   繁体   English

无法从服务器php openlayers打开文件

[英]Fail opening file from server php openlayers

I am trying to use my webpage in linux. 我想用我的网页在Linux。 I created it on windows and I am getting an strange error. 我在Windows上创建了它,但遇到了一个奇怪的错误。 I guess it is related to permissions. 我想这与权限有关。

I don't know what is the problem now, in windows it works fine but when I try the same in linux, I get this error: 我不知道现在是什么问题,在Windows中工作正常,但是当我在linux中尝试相同时,出现此错误:

Warning: Unknown: failed to open stream: Permiso denegado in Unknown on line 0

Fatal error: Unknown: Failed opening required '/opt/lampp/htdocs/open/listaZonas.php' (include_path='.:/opt/lampp/lib/php') in Unknown on line 0

Permiso denegado means something like Permissions not allowed Permiso denegado表示类似“不允许的权限”

I have a server with xampp (lampp) and there, my webpage is hosted. 我有一台装有xampp(lampp)的服务器,并且在那里托管了我的网页。 After, I have an eclipse tomcat server which serves a REST service. 之后,我有一个提供REST服务的Eclipse Tomcat服务器。

In my webpage I call this rest service to give me a file but I read it through a php file which is in my xampp server: 在我的网页中,我将此休息服务称为给我一个文件,但我通过xampp服务器中的php文件读取了该文件:

<?php
echo file_get_contents($_GET['url']); 
?>

I pass in url, the url of my rest service. 我传入url,即我的休息服务的url。 It works fine on windows and I can read the desired file without problems but now I don't know what is happening. 它在Windows上可以正常工作,我可以毫无问题地读取所需的文件,但是现在我不知道发生了什么。

do I have to configure something in xampp server? 我必须在xampp服务器中配置一些东西吗? php or something to read this file... I placed all files where they have to be. PHP或读取该文件的东西...我把所有文件都放在必须的位置。

turn on the terminal and run in the parentfolder of htdocs/ as root 打开终端并以根用户身份在htdocs /的父文件夹中运行

chmod -R 777 htdocs/

with that you make the whole htdocs folder readable, writable and executable. 这样,您就可以使整个htdocs文件夹可读,可写且可执行。 I dont recommend it for a server accesible from the internet due to security reasons but for local usage its just fine. 由于安全原因,我不建议将其用于可从Internet访问的服务器,但是出于本地使用的考虑,它就很好。

Also set the folderowner to the user of the webserver if there is one with chown . 如果有一个带有chown夹,则还要将文件夹所有者设置为Web服务器的用户。

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

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