How to view a pre-built website on a localhost

Hi everyone,

I have a website that it is fully done but I need to view it on my local host b/c I would like to update a few things on the frontend. So I have installed yii2 and xamp on my computer and I can view the basic template on my local host( a username was made in the phpmyadmin and that username was used to replace the "filler" text that was in the main-local.php file).

So I thought of extracting the website that I have into to yii2 folder that I am able to view, letting it override the duplicated files and folders, and then possibly being able to view the site that was done for me that way. But when I open any of the files on my local I get an error. One being for example:

Here are the codes, I have pointed out the referring lines in the error message:

main.php


            'class' => 'creocoder\flysystem\WebDAVFilesystem',

            // 'proxy' => 'your-proxy',

            authType' => \Sabre\DAV\Client::AUTH_BASIC,  <======= this is line 14

            'encoding' => \Sabre\DAV\Client::ENCODING_IDENTITY,

            'prefix' => '/remote.php/webdav/',

index.php


$config = yii\helpers\ArrayHelper::merge(

    require(__DIR__ . '/../../common/config/main.php'), <======= this is line 11

    require(__DIR__ . '/../../common/config/main-local.php'),

    require(__DIR__ . '/../config/main.php'),

    require(__DIR__ . '/../config/main-local.php')

);


(new yii\web\Application($config))->run();

could anyone please help me out with this? I simply to have access to the original person that made this for me. I don’t know if this helps but I have know how to code in bootstrap, html, and css but I am just now learning PHP and java.

Hopefully what I said made sense.

and thank you in advance :)

Every Yii 2 project is fully self-contained, so you can’t do what you’re doing.

The easiest way to view your project locally is simply to run a local dev server by opening a shell in the web directory of your project and issuing the command


../yii serve

Or, if getting server errors (because a web server is already on port 8080):


../yii serve --port=8888

Oh wow! That just made yii even more interesting.

So I ran both of the codes that you had posted in the root directory that the website is located in and they both responded the same error:


PHP Fatal error:  Uncaught Error: Class 'Sabre\DAV\Client' not found in C:\xampp\htdocs\advanced\common\config\main.php:14

Stack trace:

#0 C:\xampp\htdocs\advanced\yii(20): require()

#1 {main}

  thrown in C:\xampp\htdocs\advanced\common\config\main.php on line 14


Fatal error: Uncaught Error: Class 'Sabre\DAV\Client' not found in C:\xampp\htdocs\advanced\common\config\main.php:14

Stack trace:

#0 C:\xampp\htdocs\advanced\yii(20): require()

#1 {main}

  thrown in C:\xampp\htdocs\advanced\common\config\main.php on line 14

idk what is wrong could you possibly guide me toward the right direction? In the mean time I am goinng to continue reading up on yii :)

THank you!

Look at line 14 and 15 of main.php - the single quotes are not right.

Bad version:


	authType' => \Sabre\DAV\Client::AUTH_BASIC,

	'encoding' => \Sabre\DAV\Client::ENCODING_IDENTITY,



Fixed version:


	'authType' => '\Sabre\DAV\Client::AUTH_BASIC',

 	'encoding' => '\Sabre\DAV\Client::ENCODING_IDENTITY',



If you are using the advanced template - are you? then you need to go to ‘frontend/web’ and run …/…yii serve --port=8888.

I haven’t used the advanced in a long, long while - simply because I haven’t had the need for it, even for advanced applications…