#VSCODE, VISUAL STUDIO CODE

Debugging code is one of an essential thing in software developing process. Let us talk about setting up PHP debugging with Visual studio code on MacOS.

Bạn đang xem: #vscode, visual studio code

Prerequisite

Install following items

Terminal

First thing first, kiểm tra version of php. Go to lớn MAMP > Preferences > PHP


*

MAMP preference screen.

Here we go, now , we are using PHP version 7.4.2. The MAMP also provides XDebug so that you need not khổng lồ install it manually.

Then địa chỉ cửa hàng following snippets at the bottom line in php.ini

zend_extension="/Applications/MAMP/bin/php/php7.4.2/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so"xdebug.remote_enable=1xdebug.remote_host=127.0.0.1xdebug.remote_connect_back=1 # Not safe for production serversxdebug.remote_port=9000xdebug.remote_handler=dbgpxdebug.remote_mode=reqxdebug.remote_autostart=trueAdd the snippets lớn php.ini for two files.

/Applications/mamp/bin/php/php7.4.2/conf/php.ini/Applications/mamp/conf/php7.4.2/php.iniOh wait, recheck again using phpinfo();

class home extends BaseController public function index() phpinfo(); // CodeIgniter4 : app/Controllers/Home.phpIt must show something like this.

Xem thêm: Món Ngon Từ Cá Diêu Hồng Siêu Ngon Hấp Dẫn Cả Nhà, 5 Món Ngon Lạ Miệng Từ


*

localhost:8888/home/index.php

Now let us start debugging. Go to Run > Start Debugging (Press F5 for Shortcut)


*

Debugging screen.
*

Break point

php.ini example snippet (https://gist.github.com/khunemz/758db6c426b6c360facdce71d3fc2826)

Edited by : Chutipong Roobklom


More from M


Follow
Web Developer at Thaibev PLC.


Love podcasts or audiobooks? Learn on the go with our new app.


Try Knowable

More from obatambeienwasirherbal.com



Direct Line with Jason Warner, GitHub CTO
Direct Line is a series of interviews with Microsoft execs with an eye toward the startup và VC ecosystem. Our inaugural Q&A session is…
Basics of Optimization in Unity
Now that we’ve spent some time creating code for various different projects & have a good idea of how lớn build code, let’s go back and…
External Identity in Azure AD và B2X user flows
CLI User Input: Python vs JavaScript
It’s extremely easy to lớn receive user input đầu vào in Python, but what are you left with in JavaScript?
Easily create GeoJSON file from Pandas data frame
Running GKE cluster under 10$/Month: Part 2
In my previous post we discussed creating a GKE cluster khổng lồ deploy your apps. In this post, I am planning lớn walk you through how khổng lồ deploy…
Convert JSON annotation khổng lồ CSV
I was working with Object Detection using TensorFlow. After spending a lot of time in searching data… I found the one.
Hash Data Structures Quiz
Programming Quizzes
Get started

M


1 Follower


Web Developer at Thaibev PLC.


Follow

Related



PHP Snippet: Unit Testing private methods
When testing private or protected methods, the most common approach is lớn create an invokeMethod helper that, using the Reflection API…
Use Transaction In Database Operation In CakePHP 2.X
A Mini Php Mvc Structure: Zerdesht
Php is a strong language, but not that organized! Zerdeşt Mvc structure aims that solve that problem. However, Zerdeşt is now at…
Build up a laravel development environment by vagrant
Help