简体   繁体   English

在linux中为magento创建可写文件

[英]Make files writable for magento in linux

I'm new to magento and linux. 我是magento和linux的新手。 When install Magento on my localhost. 在我的localhost上安装Magento时。 i get the following warnnings: 我得到以下警告:

Path "/var/www/magic-of-motoring/app/etc" must be writable.
Path "/var/www/magic-of-motoring/var" must be writable.
Path "/var/www/magic-of-motoring/media" must be writable.

I did some research but i do not know which file path or directory i should change. 我做了一些研究,但我不知道我应该更改哪个文件路径或目录。 thank you 谢谢

将这些文件夹的所有者(所有3个文件夹,仅用于更改最后一个文件夹的所有者 - 媒体的示例)更改为www-data或将其模式更改为777。

chown www-data:www-data -R /var/www/magic-of-motoring/media

I would recommend the script at What permissions are needed to run Magento? 我建议脚本运行Magento需要什么权限?

For completeness, it's pasted below. 为了完整,它贴在下面。

#!/bin/bash

if [ ! -f ./app/etc/local.xml ]; then
    echo "-- ERROR"
    echo "-- This doesn't look like a Magento install.  Please make sure"
    echo "-- that you are running this from the Magento main doc root dir"
    exit
fi

if [ `id -u` != 0 ]; then
    echo "-- ERROR"
    echo "-- This script should be run as root so that file ownership"
    echo "-- changes can be set correctly"
    exit
fi

find . -type f \-exec chmod 644 {} \;
find . -type d \-exec chmod 755 {} \;
find ./var -type d \-exec chmod 777 {} \;
find ./var -type f \-exec chmod 666 {} \;
find ./media -type d \-exec chmod 777 {} \;
find ./media -type f \-exec chmod 666 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml

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

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