对于PHP脚本哪些权限/目录? [英] What permissions for PHP scripts/directories?

查看:246
本文介绍了对于PHP脚本哪些权限/目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想帮朋友从一个网络的酒店移动网站到另一个。
老地方已经关闭,我只有什么是它一个平坦的tar文件。

I am trying to help a friend moving a web-site from one web-hotel to another. The old place is already closed, I have only a flat tar file of what was in it.

我道歉,如果这是一个基本的问题。我是新来这...

I apologise if this is a basic question. I am new to this...

该网站中包含的HTML文档和一个可以下载​​一个小java应用程序(将在移动电话加载)将数据发送到该网站。

The web site contained html docs and one could download a little java application (to be loaded on mobile phone) to send data to the web site.

的移动Java应用程序发送的字符串URL = / PHP / register.php
这个PHP脚本包含另一个PHP脚本,../inc/db_login.php使用的连接到SQL数据库$链接= mysql_connect()函数。 register.php做SQL插入为把新发送的数据在数据库中。

The mobile java application sent a string to URL=/php/register.php This php script included another php script, "../inc/db_login.php" which connected to a SQL DB using "$link=mysql_connect().". register.php did the SQL insert for putting the new sent data in the DB.

我的问题是basicaly,我应该把新网站上的这2个PHP文件和权限的目录和文件应该有。

My question is basicaly, where I should put this 2 PHP files on the new website and what permissions the directories and files should have.

旧的Web服务器很明显有一个/ php和/ INC目录。存在于新的网络服务器这些都不...我应该创建它们?他们应该有什么权限?我想之所以在一个单独的PHP文件有密码是安全的... / php和/ INC目录可能有不同的权限...

The old web server obviously had a /php and /inc directories. None of these exists on the new webserver... Should I create them? What permission should they have? I guess the reason for having the password in a separate php file was security... The /php and /inc directory probably had different permissions...

新服务器的目录:
/ httpdos,/ httpsdos,/ cgi-bin目录,/ conf目录(和其他一些人可能不相关)

The new server has directories: /httpdos, /httpsdos, /cgi-bin, /conf (and some others probably irrelevant)

1)不将文件扩展名(.php)意味着什么到服务器:为PHP脚本在HTML code包含(之间,服务器是否需要看文件后缀或者是无关紧要?
(据我所知,在服务器上的反应,当然)

1) does the files-extension (.php) means something to the server: as PHP scripts are "included" in HTML code (between , does the server need to look at the file suffix or is it irrelevant? (I understand that the server reacts on the , of course)

2)应公共文件(在我的情况register.php)被放置在httpdocs目录或做的服务器(Apache我认为)反应的东西,并获取其在另一个目录?

2)should the "public" file (register.php in my case) be placed in the httpdocs directory or does the server (apache I think) reacts on something and fetches it in another directory?

3)如果PHP脚本的权限R-X,--X或R--?从操作系统的角度来看我猜Apache是​​刚刚读完这文件,这意味着他们应该R--,但这将意味着,如果PHP服务是停止,客户端将得到他的浏览器所有的PHP code(? )。我想preFER它是--X但是这既不是一个二进制文件,也不具有#!,我想那一定是--R ...?

3)Should the PHP script have permission R-X, --X or R-- ? From on OS perspective I guess apache is just reading this files, meaning that they should be R--, but this would mean that if PHP service is "stopped" the client would get all the PHP code in his browser(?). I would prefer it being --X but as this is neither a binary nor has a #!, I guess it must be --R...?

4)如果市民PHP脚本可以被放置在另一个目录(例如/ PHP的,而不是/ httpdocs资料)又该/ PHP(和脚本)有权限?我猜的服务器知道这个/ php目录(或者是常用的默认?)

4)If the public PHP script can be placed in another dir (e.g /php instead of /httpdocs) what should /php (and the script) have for permission?. I Guess the server has to know about this /php directory (or are there usual defaults?)

5)的PHP脚本包括(../inc/db_login.php,包含SQL密码)不应该是在/ httpdocs资料我猜。这意味着,我的register.php是包括一个文件,该文件是不是/ httpdocs资料子树下......请问这项工作?服务器是否需要知道什么?

5)The PHP script included (../inc/db_login.php, containing SQL password) should not be under /httpdocs I guess. This means that my register.php is including a file which is not under the /httpdocs subtree... Does this work? Does the server need to know?

我知道你可能需要知道服务器配置...只是假设默认你的答案(你可以说出它被改变,如果它是)。

I understand you may need to know the server configuration... Just assume the default in your answer (and you can tell where it is changed if it is).

我是新来这个(PHP / SQL /阿帕奇/网站),所以要在这个描述吧。我知道Perl,Python和C和linux的相当好,少说明需要有: - )

I am new to this (PHP/SQL/ apache/ Web site) so be descriptive on this please. I know perl, python, C and linux rather well, less description needed there :-)

非常感谢。

/克里斯托夫。

推荐答案

目录必须具有执行权限是可用的。通常这是 0755 。 PHP脚本通过 mod_php的运行不被执行,而是读; 0644 就足够了这一点。需要通过Web服务器正在运行的用户拥有必须写入目录。有可能是对权限的其他担忧,如SELinux的,但上面会陪你度过的基本知识。

Directories must have execute permissions to be usable. Usually this is 0755. PHP scripts run via mod_php are not executed but rather read; 0644 will suffice for this. Directories that must be written to need to be owned by the user the web server is running as. There may be additional concerns regarding permissions, e.g. SELinux, but the above will get you through the basics.

这不能由其他用户或外部客户端可以访问文件应 0600 ,由web服务器的用户所拥有,以及位于DocumentRoot的外侧。注意在安全模式下运行这将mod_php,并且prevent脚本从不断,包括的DocumentRoot以外的任何东西;可悲的缺陷。

Documents that must not be accessed by other users or external clients should be 0600, owned by the web server user, and located outside the DocumentRoot. Note that running mod_php in Safe Mode will prevent scripts from ever including anything outside the DocumentRoot; a lamentable flaw.

这篇关于对于PHP脚本哪些权限/目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆