PHP scripts that are used to connect to the database need access to the password for
that user.This can be done reasonably securely by putting the login and password in a
file called, for example, dbconnect.php, that you then include when needed.This script
can be carefully stored outside the web document tree and made accessible only to the
appropriate user.我初学网页编程,看的是PHP和MySQL Web开发,我想问下这句话怎么理解。
This script can be carefully stored outside the web document tree and made accessible only to the appropriate user.不把脚本放在文件树下,那上传到虚拟空间后,怎么访问这个脚本呢?phptreeweb开发
that user.This can be done reasonably securely by putting the login and password in a
file called, for example, dbconnect.php, that you then include when needed.This script
can be carefully stored outside the web document tree and made accessible only to the
appropriate user.我初学网页编程,看的是PHP和MySQL Web开发,我想问下这句话怎么理解。
This script can be carefully stored outside the web document tree and made accessible only to the appropriate user.不把脚本放在文件树下,那上传到虚拟空间后,怎么访问这个脚本呢?phptreeweb开发
能举个例子吗?谢谢!web document tree网页文件树是什么意思呢?
把这个脚本放在网页文件树的外面,是哪里呢?
那这个MyWeb就是网页文件树了?但是上传的时候还不是要把这个两个文件夹都上传,那别人还不是有办法访问到我的数据库文件
这个敏感文件包括, 连接数据库的用户名和密码等.MYSQL文件夹是数据库层面的,这个可以通过导入导出来完成数据的初始化和备份操作,不在这个讨论范围之内.
PHP scripts that are used to connect to the database need access to the password for
that user.This can be done reasonably securely by putting the login and password in a
file called, for example, dbconnect.php, that you then include when needed.This script
can be carefully stored outside the web document tree and made accessible only to the
appropriate user.这段话说把dbconnect.php这个脚本放在文件树外面,因为它包含用户名和密码,是敏感文件。
那这个文件树外面究竟是哪里呢?我上传的时候不和文件树一起上传?
这主要是防止意外的情况匿名访问者能看到php源代码,例如php解析突然出现问题,php文件原文显示了
又或者忘了加容错和隐藏错误信息,连接数据库的php文件名暴露了虚拟空间的数据库一般都不允许外来访问,只能本地127.0.0.1连接,所以密码外泄在短时间内还是不用担心的,尽快改密码就行至于黑客行为,就不是这里所能解决的事了
谢谢你,(这句话是给有服务器控制权的建议) 这句话让我明白了。在我自己电脑上我是这样做了,虚拟空间就没办法了。我一直以为虚拟空间也可以。还想问下你,那dbconnect.php这个包含密码的脚本,就虚拟空间而言,只能放在文件树里一起上传了是吧。
这样岂不是很不安全?
虽然 dbconnect.php这个包含密码 但也要进入到文件系统才能看到
如果入侵者能够进入虚拟空间的文件系统,那么他有什么不可以做的呢。即便你的dbconnect.php没放在web管辖范围,不还是一样能看到吗。更何况数据库里面还有一份呢?