Home PHP Framework YII How to access debug in yii2

How to access debug in yii2

Mar 11, 2020 pm 01:52 PM
debug yii2

How to access debug in yii2

1. Project installation debug tool

php composer.phar require --prefer-dist yiisoft/yii2-debug
Copy after login

2. Configure web/index.php

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
Copy after login

3. Configure config/web.php

if(file_exists(__DIR__ . "/web-local.php")) {
    $localConfig = require __DIR__ . "/web-local.php";
    $config = ArrayHelper::merge($config, $localConfig);
}
Copy after login

(Related tutorials recommended: yii framework)

4. Add web-local.php

<?php
 
$localConfig = [
    &#39;components&#39; => [
        &#39;log&#39; => [
            &#39;traceLevel&#39; => YII_DEBUG ? 3 : 0,
            &#39;targets&#39; => [
                [
                    &#39;class&#39; => &#39;yii\log\FileTarget&#39;,
                    &#39;levels&#39; => [&#39;error&#39;, &#39;warning&#39;],
                ],
            ],
        ],
    ],
];
 
if (YII_ENV_DEV) {
    // configuration adjustments for &#39;dev&#39; environment
    $localConfig[&#39;bootstrap&#39;][] = &#39;debug&#39;;
    $localConfig[&#39;modules&#39;][&#39;debug&#39;] = [
        &#39;class&#39; => &#39;yii\debug\Module&#39;,
        // uncomment the following to add your IP if you are not connecting from localhost.
        //&#39;allowedIPs&#39; => [&#39;127.0.0.1&#39;, &#39;::1&#39;],
        &#39;allowedIPs&#39; => [&#39;*&#39;],
    ];
 
    $localConfig[&#39;bootstrap&#39;][] = &#39;gii&#39;;
    $localConfig[&#39;modules&#39;][&#39;gii&#39;] = [
        &#39;class&#39; => &#39;yii\gii\Module&#39;,
        // uncomment the following to add your IP if you are not connecting from localhost.
        //&#39;allowedIPs&#39; => [&#39;127.0.0.1&#39;, &#39;::1&#39;],
    ];
}
 
return $localConfig;
Copy after login

5. Set the runtime directory to be readable and writable

The above is the detailed content of How to access debug in yii2. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem of invalid debugging when setting breakpoints in SpringBoot project How to solve the problem of invalid debugging when setting breakpoints in SpringBoot project May 11, 2023 am 10:49 AM

I am new to the springboot project. (1) I found that breakpoint debugging was ineffective. I was very depressed and searched for solutions online. All I saw were some very complicated solutions, which were said to be remote debugging, but also required additional opening slogans. This is different from a traditional project, so I don’t think it’s necessary. So after some exploration, I found that there is a simpler way. The steps are as follows: Add a configuration in the plugin part of the pom file: false and it will be ok; (2) Regarding the error in the SpringBoot project that the web.xml file is missing, because Traditional web projects require web.xml files, but SpringBoot projects do not require web.xml files.

How to remove jquery in yii2 How to remove jquery in yii2 Feb 17, 2023 am 09:55 AM

How to remove jquery from yii2: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and add the configuration "'yii" under the field "components" \web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

Take you to debug Nestjs project in VSCode (tutorial) Take you to debug Nestjs project in VSCode (tutorial) Apr 24, 2023 pm 05:53 PM

Friends who have used Vscode to write projects such as Node all know that if we want to troubleshoot a problem, we mostly print it through console.log to see where the problem is. If the problem involved is more complex, we will choose Through Vscode...

A few selected CTF exercises will help you learn the yii2 framework! A few selected CTF exercises will help you learn the yii2 framework! Feb 23, 2022 am 10:33 AM

This article will introduce you to the yii2 framework, share a few CTF exercises, and use them to learn the yii2 framework. I hope it will be helpful to everyone.

How to use IDEA remote connection Debug in springboot How to use IDEA remote connection Debug in springboot May 10, 2023 pm 11:55 PM

1. First create a Demo ready for remote debugging. Pay attention to the configuration of the build project 4.0.0org.springframework.bootspring-boot-starter-parent2.1.4.RELEASEcom.remote.testremote_test0.0.1-SNAPSHOTremote_testDemoprojectforSpringBoot1.8org.springframework.bootspring-boot- starterorg.springframework.bootspring-bo

How to install Redis extension using YII2 framework How to install Redis extension using YII2 framework May 26, 2023 pm 06:41 PM

1. You need to download the windows version of the master branch of yii2-redis with composer 2. Unzip and copy it to vendor/yiisoft 3. Add 'yiisoft/yii2-redis'=>array('name'=>'yiisoft to extensions.php under yiisoft /yii2-redis','version'=>'2.0.

How to effectively deal with overflow problems How to effectively deal with overflow problems Jan 27, 2024 am 09:39 AM

How to Correctly Deal with Overflow Problems Overflow is a common computer programming problem, especially when dealing with numbers or arrays. Overflow occurs when we try to store a value that exceeds the allowed range of the data type. The key to solving this problem lies in correctly handling and validating data boundaries. Several common overflow problems and corresponding solutions will be introduced below. Integer overflow Integer overflow means that during calculation, the result exceeds the representation range of the integer type. For example, in the 32-bit signed integer type in

UCIe 2.0: Advancing the open chiplet ecosystem with 3D packaging and manageability UCIe 2.0: Advancing the open chiplet ecosystem with 3D packaging and manageability Aug 08, 2024 pm 12:51 PM

The Universal Chiplet Interconnect Express (UCIe) Consortium has announced the release of the UCIe 2.0 specification, further advancing the open chiplet ecosystem. The latest specification introduces several key enhancements. First, it adds support f

See all articles