5

I tried to run my Yii2 application on Localhost, XAMPP for PHP 5.6.32 and Windows 8 but I got this error: image1

image2

How do I resolve this problem.

Thanks

Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68
M.O. Idowu
  • 207
  • 1
  • 2
  • 11

2 Answers2

14
  • The problem mostly occurs when you don't start the server/Xampp on local with administrative privilege. Try to start Xampp from the control panel if you are on windows.

  • Alternatively, you can use the option to disable the symlink by adding the assetManager setting under the components section in your config file (for yii-advance app it can be the common/config/main.php or the config/web.php in the yii-basic app)

    'components'=>[
         'assetManager' => [
             'linkAssets' => false
         ],
    ]
    

UPDATE

There could be a possibility that you get the above error while running any of the commands on the terminal like while contributing into the yii2 repo you have to run the command php build/build dev/app basic <fork> during which it creates a symlink and throws the above error, and after trying both of the above you still dont get it to work in that case you might have to use the default command prompt for the windows by starting it as an administrator and then run the above command.

Muhammad Omer Aslam
  • 22,976
  • 9
  • 42
  • 68
1

In case you are in development mode I recommend you to leave the 'linkAssets' parameter set to 'true' so you don't have to delete the assets every time you make a change. (In production it is recommended to set it to 'false').

To solve your problem run xampp as administrator:

To run the control panel as administrator, you can right click on the shortcut icon (Start > XAMPP > XAMPP Control Panel) and choose the option "More > Run as administrator". I leave you a link where it is better explained: Execute xampp as admin

dobra
  • 61
  • 1
  • 3