1

I'm trying to set some xdebug 3 config values in an .htaccess file, but I keep getting "500 Internal Server Error" results.

With xdebug 2 I could set config values by using php_flag instructions, such as:

php_flag xdebug.remote_autostart on

With xdebug 3 the xdebug config settings have changed, but all but one setting is supposed to be available in .htaccess (xdebug.mode is the lone exception). According to xdebug documentation:

Unless specifically mentioneds, each setting can be set in php.ini, files like 99-xdebug.ini, but also in Apache's .htaccess and PHP-FPM's .user.ini files.

I also tried setting the XDEBUG_CONFIG environmental variable in .htaccess but PhpStorm is not honoring it (setting XDEBUG_CONFIG does not generate a "500" page).

SetEnv XDEBUG_CONFIG "start_with_request=yes client_host=localhost"

I could enable xdebug in my php.ini file, but I don't want it enabled for all the local php code I'm running. Enabling xdebug in an .htaccess file allows me to only enable it for specific projects or code.

I'm running PHP 8.0 via MAMP on macOS, and coding/debugging in PhpStorm 2021.3 using xdebug v3.0.0.

Any help would be appreciated.

Mr Glass
  • 1,186
  • 1
  • 6
  • 14

1 Answers1

2

This issue was "solved" by fixing the syntax error in my php_flag instructions. When I copied the working settings from the php.ini file I forgot to remove the = between the setting and the value.

# incorrect - caused the "500 Internal Server Error" results
php_flag xdebug.start_with_request=yes

# correct = without the "="
php_flag xdebug.start_with_request yes

Sorry for the false alarm.

Mr Glass
  • 1,186
  • 1
  • 6
  • 14