Error on public_html

Published 4 months ago by davy_yg

Hello,

Can anyone help me read this code on public_html. I have this error appearing:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\framework_freshway\public_html\index.php on line 50

davy_yg

(I have another question: I just posted a long codes and now I wonder why it is being cut ?) Other programmers cannot see the programs that I posted then.

dharmendrajadon

Use 4 spaces for lines having code

code here
davy_yg

I prefer not to update it since it is someone else files. It is a laravel file that I downloaded and I try it to run it offline from my web browser: EasyPHP 14.1

If I have to update it do I have to update it to a newer version of laravel? Since I only learn laravel only for 4 days. I don't think I have time for it.

davy_yg

I get this error message:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\framework_freshway\public_html\index.php on line 50

And this is my codes:

 <?php

 /**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

 /*
 |--------------------------------------------------------------------------
 | Register The Auto Loader
 |--------------------------------------------------------------------------
 |
 | Composer provides a convenient, automatically generated class loader for
 | our application. We just need to utilize it! We'll simply require it
 | into the script here so that we don't have to worry about manual
 | loading any of our classes later on. It feels nice to relax.
 |
 */

  require __DIR__.'/../framework/bootstrap/autoload.php';

  /*
  |--------------------------------------------------------------------------
  | Turn On The Lights
  |--------------------------------------------------------------------------
  |
  | We need to illuminate PHP development, so let us turn on the lights.
  | This bootstraps the framework and gets it ready for use, then it
  | will load up this application so that we can run it and send
  | the responses back to the browser and delight our users.
  |
  */

   $app = require_once __DIR__.'/../framework/bootstrap/app.php';

   /*
   |--------------------------------------------------------------------------
   | Run The Application
   |--------------------------------------------------------------------------
   |
   | Once we have the application, we can handle the incoming request
   | through the kernel, and send the associated response back to
   | the client's browser allowing them to enjoy the creative
   | and wonderful application we have prepared for them.
   |
   */

   $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

   $response = $kernel->handle(
   $request = Illuminate\Http\Request::capture()
   );

   $response->send();

   $kernel->terminate($request, $response);

Line 50: $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

tisuchi
tisuchi
4 months ago (159,515 XP)

I am not sure whether you are trying to upload your project in shared hosting (cPanel) or not.

If you are trying to host in cPanel, you must need to change something either in index.php or .htaccess file because the structure of cPanel and Laravel are different.

So, you may be check this video for changing a bit in index.php file. https://www.youtube.com/watch?v=pBTvXKGvrAA

davy_yg

I watch the video but I cannot understand the folder structure and how the path suppose to be.

framework_freshway

  - framework

  - public_html/index.php

Any clue with this folder structure how the path suppose to be:

require DIR.'/../framework/bootstrap/autoload.php';

I thought the path is correct already. Any clue?

MaverickChan

IF you want to use laravel , you need to GET laravel correctly.

please follow the tutorials or read the doc of laravel.com,

instead of just COPYing someone else's code .

It just won't run , no , never and ever.

davy_yg

Yes, I have read the documentation. And now, I have a task to edit someone else laravel codes for my job. That's why I posted this question for help.

I thought you guys are expert in laravel.

samalapsy

Hello,

Can anyone help me read this code on public_html. I have this error appearing:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\framework_freshway\public_html\index.php on line 50

@davy_yg Ensure you have composer installed and that you can run php artisan from your comcoCheck your PHP Version make sure it meets the requirement of your currently installed laravel framework

davy_yg

I renew my EasyPHP into EasyPHP 7.0 which is compatible with php7.0 but now I do not know which

command-line php that I want to use: [ Browse ]

Which file should I pick for the composer-setup.exe after I run it?

I try to pick php.exe (2 versions) both does not work. It has an error message appearing. Any other idea which file to pick?

MaverickChan

why are you sticking to use easyPHP , not using something else like wamp or installing a apache php server ? laravel need some php dependence to work . your server environment does not seem right to me. if php.exe is not working , you cannot clear cache . without composer , you cannot update and install things.

i don't expect you understand , even if you said you have READ the doc.

samalapsy

I try to pick php.exe (2 versions) both does not work. It has an error message appearing. Any other idea which file to pick?

@davy_yg

You can try WAMP or XAMPP Server I don't know if that's what your company make use of.. Just like @MaverickChan Said..

But If you can solve the issue of installing composer and having your artisan working then you're good to Go

davy_yg

I try Xampp and I get this error message:

   1/1 PDOException in Connector.php line 50: SQLSTATE[HY000] [2002]     No connection could be made because the target machine actively refused it.

 in Connector.php line 50
 at PDO->__construct('mysql:host=soulfy.com;dbname=wwwsoulf_revsoul',  'wwwsoulf_revsoul', '7tX;z~4K(PWWeJsG5@qwg(23!', array('0', '2', '0', false, false)) in Connector.php line 50
 at Connector->createConnection('mysql:host=soulfy.com;    dbname=wwwsoulf_revsoul', array('driver' => 'mysql', 'host' => 'soulfy.com', 'database' => 'wwwsoulf_revsoul', 'username' => 'wwwsoulf_revsoul', 'password' => '7tX;z~4K(PWWeJsG5@qwg(23!', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 22
   at MySqlConnector->connect(array('driver' => 'mysql', 'host' => 'soulfy.com', 'database' => 'wwwsoulf_revsoul', 'username' => 'wwwsoulf_revsoul', 'password' => '7tX;z~4K(PWWeJsG5@qwg(23!', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 60
    at ConnectionFactory->createSingleConnection(array('driver' => 'mysql', 'host' => 'soulfy.com', 'database' => 'wwwsoulf_revsoul', 'username' => 'wwwsoulf_revsoul', 'password' => '7tX;z~4K(PWWeJsG5@qwg(23!', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql')) in ConnectionFactory.php line 49
    at ConnectionFactory->make(array('driver' => 'mysql', 'host' => 'soulfy.com', 'database' => 'wwwsoulf_revsoul', 'username' => 'wwwsoulf_revsoul', 'password' => '7tX;z~4K(PWWeJsG5@qwg(23!', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'name' => 'mysql'), 'mysql') in DatabaseManager.php line 175
    at DatabaseManager->makeConnection('mysql') in DatabaseManager.php line 67
    at DatabaseManager->connection('mysql') in Model.php line 3152
    at Model::resolveConnection(null) in Model.php line 3118
    at Model->getConnection() in Model.php line 1866
    at Model->newBaseQueryBuilder() in Model.php line 1809
    at Model->newQueryWithoutScopes() in Model.php line 1783
    at Model->newQuery() in Model.php line 3364
    at Model->__call('where', array('domain', 'localhost'))
    at call_user_func_array(array(object(User), 'where'), array('domain', 'localhost')) in Model.php line 3380
    at Model::__callStatic('where', array('domain', 'localhost')) in HomeController.php line 323
    at HomeController->getHome()
    at call_user_func_array(array(object(HomeController), 'getHome'), array()) in Controller.php line 256
    at Controller->callAction('getHome', array()) in ControllerDispatcher.php line 164
    at ControllerDispatcher->call(object(HomeController), object(Route), 'getHome') in ControllerDispatcher.php line 112
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114
    at ControllerDispatcher->callWithinStack(object(HomeController), object(Route), object(Request), 'getHome') in ControllerDispatcher.php line 67
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'Soulfy\Http\Controllers\HomeController', 'getHome') in Route.php line 201
    at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
    at Route->run(object(Request)) in Router.php line 704
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
    at Pipeline->then(object(Closure)) in Router.php line 706
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 669
    at Router->dispatchToRoute(object(Request)) in Router.php line 631
    at Router->dispatch(object(Request)) in Kernel.php line 237
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 54
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
    at StartSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
    at EncryptCookies->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
    at Pipeline->then(object(Closure)) in Kernel.php line 123
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 88
    at Kernel->handle(object(Request)) in index.php line 53

framework_freshway/public_html/index.php

  <?php

  /**
  * Laravel - A PHP Framework For Web Artisans
  *
  * @package  Laravel
  * @author   Taylor Otwell <[email protected]>
  */

  /*
 |--------------------------------------------------------------------------
 | Register The Auto Loader
 |--------------------------------------------------------------------------
 |
 | Composer provides a convenient, automatically generated class loader for
 | our application. We just need to utilize it! We'll simply require it
 | into the script here so that we don't have to worry about manual
 | loading any of our classes later on. It feels nice to relax.
 |
 */

 require __DIR__.'/../framework/bootstrap/autoload.php';

 /*
 |--------------------------------------------------------------------------
 | Turn On The Lights
 |--------------------------------------------------------------------------
 |
 | We need to illuminate PHP development, so let us turn on the lights.
 | This bootstraps the framework and gets it ready for use, then it
 | will load up this application so that we can run it and send
 | the responses back to the browser and delight our users.
 |
 */

 $app = require_once __DIR__.'/../framework/bootstrap/app.php';

 /*
 |--------------------------------------------------------------------------
 | Run The Application
 |--------------------------------------------------------------------------
 |
 | Once we have the application, we can handle the incoming request
 | through the kernel, and send the associated response back to
 | the client's browser allowing them to enjoy the creative
 | and wonderful application we have prepared for them.
 |
 */

 $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

 $response = $kernel->handle(
 $request = Illuminate\Http\Request::capture()
 );

 $response->send();

 $kernel->terminate($request, $response);
davy_yg

I already run: https://getcomposer.org/download/

but do now know how to run the composer?

Sign In or create a forum account to participate in this discussion.