如何将网站上传到文件夹可写入 php 的服务器
这个问题已经在我身上出现过很多次了,现在是我采取正确方法的时候了!
如何将网站上传到服务器,其中 php 可以访问文件夹以写入数据。
通常我使用FTP程序,但我无法以root身份上传,所以到处都有限制问题......
你如何做这样的事情?
谢谢!
编辑
对不起,我不小心将rails添加到标签中,而不是从php中添加。
也许我需要澄清我的问题,因为答案并没有真正帮助我:
我已经有一个运行 apache、DirectAdmin 和其他一些东西(如 Rails)的服务器。
问题是,当我通过 FTP 上传 joomla 或 wordpress 等网站时,限制始终需要设置为 777/775,否则这些网站无法写入文件夹。
所以我需要知道的是: 我如何以与 php 相同的用户(root)上传这些网站(通过 FTP/SSH),以便 php 可以在它需要写入的所有文件夹中创建文件?
希望我现在更清楚了,感谢迄今为止的帮助!
This problem occurred to me multiple times now, and it's time for me to do it the right way!
How can I upload a website to the server, where php has access to the folders for writing data.
Usually I use an FTP program, but I can't upload as root, so there are restriction problems all over the place...
How do you do stuff like this?
Thanks!
EDIT
I'm sorry, I accidentally added rails to the tags instead off php.
Probably I need to clarify my problem, since the answers didn't really help me out here:
I already have a server running apache, DirectAdmin and some other stuff like rails.
And the problem is when I upload a website like joomla or wordpress via FTP the restrictions always need to be set to 777/775 or these sites can't write to the folders..
So what I need to know is:
How can I upload these sites (via FTP/SSH) as a user (root) that is the same as php, so that php can create files in all folders it needs to write to?
Hope I'm being more clear now, thanks for the help so far!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用具有 ssh 访问权限的服务器,并且对托管 Rails 应用程序的任何位置都具有完全写入访问权限(通常 ssh 访问权限是作为运行 Rails 的用户)。
对我来说,这通常意味着 VPS 类型服务器,我喜欢 Rackspace Cloud,每台价格约为 11 - 15 美元低流量、低规格服务器的一个月。我还听说过关于 Linode 的好消息
Use a server with ssh access and full write access to wherever your Rails app is hosted (and usually ssh access is as the user that Rails runs as).
For me this usually means a VPS type server, I like Rackspace Cloud which turns out to be around $11 - $15 per month for a low traffic, low spec server. I've also heard good things about Linode
解决方案
使用 FTP 上传您的网站
SSH 到服务器并转到
public_html
文件夹chown -R [user_name]:[group_name] [folder_name]
对我来说,正确的用户是 apache..
The solution
Upload your site with FTP
SSH to the server and go to the
public_html
folderchown -R [user_name]:[group_name] [folder_name]
For me the right user was apache..