Problem opening application in Yii2

0

I am presenting the following problem and that is when opening my Yii2 application, the charge in my browser as follows link and I get the following error Fatal error: Cannot use 'Object' as class name as it is reserved in C:\xampp\htdocs\basic\vendor\yiisoft\yii2\base\Object.php on line 77

I'm using Xampp

Try changing the line referenced by the error from Object to BaseObject and I get the following error Fatal error: Cannot declare class yii\base\BaseObject, because the name is already in use in C:\xampp\htdocs\basic\vendor\yiisoft\yii2\base\Object.php on line 77

I also do the Object.php refactor to BaseObject and it throws me the following error

I managed to do composer update and when I go to open the application I get the following error Can not use 'Object' as class name as it is reserved

    
asked by Sebastian Salazar 28.03.2018 в 04:10
source

2 answers

0

To use the Yii2 version with Apache as a web server, you need to make the following configuration in the httpd.conf file

# Set document root to be "basic/web"
DocumentRoot "C:\xampp\htdocs\basic\web"

<Directory "C:\xampp\htdocs\basic\web">
    # use mod_rewrite for pretty URL support
    RewriteEngine on
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward the request to index.php
    RewriteRule . index.php

    # if $showScriptName is false in UrlManager, do not allow accessing URLs with script name
    RewriteRule ^index.php/ - [L,R=404]

    # ...other settings...
</Directory>

Once this configuration is done, you must restart XAMPP. You can see more detail about these recommendations in the official documentation

    
answered by 29.03.2018 в 00:57
0
  

I recommend you try first with a composer update composer update :)

As of the version of PHP_7.2 (I think) Object has been translated into a reserved word and the error that appears is normal, Yii solved this from the version of Yii2.0.13,

So if you want to solve your problem, I suggest you look at the documentation on how to migrate this.

Here's the documentation

To summarize you're going to have to make a nice refactor yii / base / Object.php and change it to yii / base / BaseObject.php.

    
answered by 31.03.2018 в 14:03