Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xdebug can not be automatically enabled #332

Open
Pen-y-Fan opened this issue Sep 19, 2022 · 7 comments
Open

Xdebug can not be automatically enabled #332

Pen-y-Fan opened this issue Sep 19, 2022 · 7 comments

Comments

@Pen-y-Fan
Copy link

When Xdebug is downloaded* and copied to the ext directory, when switching to Lagaon and try to enable in Extensions or Quick settings, Laragon does not automatically add the Xdebug extension.

It is listed in the list of Extentions, when clicked the menu closes. If Apache is running it is restarted. However, the extension isn't added to php.ini

The workaround is to manually add the extension to php.ini :

[xdebug]
zend_extension=xdebug-3.1.5-8.1-vs16-x86_64
xdebug.mode = coverage,debug,develop

Laragon will then toggle the Xdebug extension on and off via Extensions or Quick settings (add and remove a ;)

This was also a problem with Laragon 5, it was brought up on the forum, but I guess no one raised it as a GitHub issue 🤷‍♂️

I'm not 100% sure when it broke, possibly around 3.1.0, there is a post stating it works with Xdebug 3.0.4.

  • the Windows dll for 3.1.5 is under historical downloads, it looks like the alpha version doesn't have a Windows build.
@Pen-y-Fan
Copy link
Author

Are you able to enable any of the other PHP extensions? On Laragon 6 I cannot enable any.

I tried pdo_sqlite and it enabled straight away. 🎉

However I also tried dl_test and zend_test, not sure what there extensions are, nothing enabled 🤷‍♂️ (see screenshot)

Image: PHP extensions

@rforced
Copy link

rforced commented Sep 19, 2022

Yea, I tried Redis extension as well, doesn't enable at all.

@msiemaszko
Copy link

To proper enable/disable extension by laragon you should defined extensions in php.ini without "php_" prefix, even if your manually downloaded library have prefix in name

ex. for php_xdebug-3.1.5-8.1-vs16-nts-x86_64.dll define in php.ini

[xdebug]
zend_extension=xdebug-3.1.5-8.1-vs16-nts-x86_64 

@rforced
Copy link

rforced commented Oct 13, 2022

@msiemaszko yes, you can do it manually. However one of Laragon's features is to enable and disable extensions from the right click menu. That's what this issue is about.

@juanmalunatic
Copy link

@rforced

I tried @msiemaszko's comment and it works fine. Did you give the instructions a try?

When you enable the extension manually you don't remove the "php" prefix. If you do this, Laragon's right click menu to enable/disable won't work.

When you do as @msiemaszko suggested, removing the prefix, the extension will be managed by Laragon's menu.

@jakubtro13
Copy link

Hi,
The best methods was on official web page : https://xdebug.org/docs/install#windows
Result of installation wizard example on my Win10 and my php.ini :
Download php_xdebug-3.2.0-8.1-vs16-nts-x86_64.dll
Move the downloaded file to F:\laragon\bin\php\php-8.1.12-nts-Win32-vs16-x64\ext, and rename it to php_xdebug.dll
Update F:\laragon\bin\php\php-8.1.12-nts-Win32-vs16-x64\php.ini and add the line:
zend_extension = xdebug

@Pen-y-Fan
Copy link
Author

@jakubtro13 the last step is incomplete, the php.ini needs a minimum of two lines to work, or with Nginx, it needs three:

[xdebug]
; these two lines are required for xDebug 3+
zend_extension = xdebug
xdebug.mode=coverage,debug,develop
; Laragon has a conflict with Nginx and xDebug using port 9003, set xDebug to use 9000.
xdebug.client_port=9000

Prior to xDebug 3.0.4 all we needed to do was steps one and two: download and copy to the ext directory., Laragon used to automatically detect and add the zend_extension = xdebug..... to php.ini.

I tried removing my xDebug setting from the php.ini and renaming the DLL to php_xdebug.dll. Laragon will show the xDebug option in PHP > quick settings > xdebug but will not automatically add it to the php.ini as it used to do.

Once the above lines are added to the php.ini, then Laragon will happily toggle xDebug on and off.

I'm not even sure if @leokhoa can add/fix the feature. Previously Laragon would only add the extension to the ini file. From xDebug 3 the second line is also required to enable the required mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants