I got an error after setting localhost , accessing localhost.

my virtual host configuration is below : ServerName local.defaultMagento.com

DocumentRoot "/Users/Androider/defaultMagento"

<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"
    Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, PUT"
    Header set Access-Control-Allow-Credentials true

<Directory "/Users/Androider/defaultMagento">
    AllowOverride All
    Require all granted

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule ^api/rest api.php?type=rest [QSA,L]
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
        RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
        RewriteRule .* - [L,R=405]
        RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
        RewriteRule .* index.php [L]

I searched a lot and finally found that it may be caused by the permission in virtualHostConfiguration file.

But I think what I've done is nothing wrong...

Is there anyone helping me?

  • Which folder is it trying to create? You probably need to set appropriate permissions on the var directory
    – scrowler
    Dec 27, 2015 at 20:00
  • You tagged it magento2 yet vhost config is most likely for mmagento 1.x
    – Zefiryn
    Apr 20, 2017 at 9:09

2 Answers 2


This is a file permission issue. Please follow http://devdocs.magento.com/guides/v2.0/install-gde/prereq/apache-user.html#install-update-depend-user-create to set proper permissions for your filesystem and users.


I was facing the similar issue. It was due to two or more apache running on same system.

I had installed previously wampp and then xampp. Working on xampp, magento2, i got above error. What i did was simply uninstall wampp, restart apache of xampp and all was fine.

Hope it Helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.