Asked  7 Months ago    Answers:  5   Viewed   39 times

So macOS High Sierra 10.13 now comes with PHP 7.1. While configuring Apache I also created a new /etc/php.ini from the /etc/php.ini.default file, made sure to check that is was being loaded by PHP after restarting Apache, however the version of Xdebug extension that ships with macOS 10.13 doesn't seem to load or show up when you run phpinfo();

My php.ini is definitely being loaded:

$ php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

Here's what my /etc/php.ini looks like where I configure Xdebug:

zend_extension = "/usr/lib/php/extensions/no-debug-non-zts-20160303/"

[Update, fixed that typo here...]

However, Xdebug doesn't load and checking php -i give no results:

$php -i | grep xdebug
PHP Warning:  Method xdebug_start_function_monitor() cannot be a NULL 
    function in Unknown on line 0
    PHP Warning:  xdebug: Unable to register functions, unable to load in Unknown on line 0
    Segmentation fault: 11

And yes, the path to the file is correct:

$ ls /usr/lib/php/extensions/no-debug-non-zts-20160303/

This used to work on PHP 5 so I hope someone can help me and anyone else in future struggling with this issue.

When I check my apache log I get the following error:

Failed loading /usr/lib/php/extensions/no-debug-non-zts-20160303/  dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/, 9): Symbol not found: _xdebug_monitored_function_dtor
  Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20160303/
  Expected in: flat namespace
 in /usr/lib/php/extensions/no-debug-non-zts-20160303/

I'm not making progress in terms of find out how I can resolve this error:

Symbol not found: _xdebug_monitored_function_dtor



Ok so I finally got it running myself it works perfectly! I'm assuming that the xdebug binary that comes with macOS High Sierra (found under: /usr/lib/php/extensions/no-debug-non-zts-20160303/ is not compatible with PHP7's new Zend engine.

So I downloaded the latest source from the xdebug website and did the following:

  1. Installed autoconf with brew;
  2. Run phpize to configure the build for the new Zend engine;
  3. Run ./configure
  4. Run make

Now the new binary is under modules/

However macOS System Integrity Protection (SIP) will prevent you from overwriting the under /usr/lib/php/extensions/. I didn't want to disable this so I created a new directory path under /usr/local/lib/php/extensions/ and copied the new binary to this location. I'm not sure if this directory is the best place to put it or if this is bad practice but it worked for me.

Finally I reconfigured my php.ini to use the new binary and everything worked perfectly!

Wednesday, March 31, 2021
answered 7 Months ago

To answer your confusion directly, two settings stand out. They are xdebug.remote_host and xdebug.remote_connect_back. The former setting's IP is incorrect, especially in a Vagrant setup. It should be something like Furthermore, the latter setting should not be defined and enabled. When it is enabled, it completely ignores the former setting, thus rendering it useless. To summarize, the former setting is wrong, and the latter setting ignores it, but that latter setting is also wrong. These settings are only part of the reason Xdebug will not work, though.

Extended: setup Xdebug in PhpStorm with Vagrant

Vagrant introduces a layer of complexity not present in a standard, non-virtualized development environment. While the points above are probably correct, there are still additional settings and procedures that need to be followed in order to run Xdebug in PhpStorm through Vagrant. I struggled with this for a while, and after several failed attempts, succeeded in getting a connection. There is also a big deficit in documentation available online to achieve this kind of setup, so after successfully getting the whole setup working, I documented the guidelines on my blog. The entire setup process is described in detail, peppered with relevant screenshots. I also use CentOS 6.5 64bit, and the guidelines reflect that. It has even been tested against Magento.

How to configure Xdebug in PhpStorm through Vagrant

Wednesday, March 31, 2021
answered 7 Months ago

My default setups

  1. MAMP 2.2. Installation directory is "default".
  2. Phpstorm 7.0. The basic config are done as per guided by the online doc.
  3. A Phpstorm project has been setup with sample codes ready for debugging.
  4. Chrome browser is used. Feel free to contribute if you would like to share on other browsers.

Configuring php.ini in MAMP to enable Xdebug

  1. Open /Applications/MAMP/bin/php/php5.4.4/conf/php.ini.
  2. Do remember to open the correct directory corresponding to the php ver of your choice. So if you want to use other versions, then note the corresponding version s/n such as /Applications/MAMP/bin/php/php(corresponding version number)/conf/php.ini.
  3. Go to last line and delete ";" before "zend_extension" to uncomment the line.
  4. Next, add this line below "xdebug.remote_enable = 1".
  5. The result should look like this:

    zend_extension="/Applications/MAMP/bin/php/php(**corresponding version number**)/lib/php/extensions/no-debug-non-zts-(**some numbers given.  Do not change**)/"
    xdebug.remote_enable = 1

Check if Xdebug is successfully enabled

  1. Restart your MAMP server.
  2. From Chrome, run "localhost:8888/MAMP/phpinfo.php".
  3. You should be able to find somewhere down the line for the Xdebug header. The first table row should show xdebug support > enabled.
  4. Note that xdebug.remote_enable table row should show "on".
  5. Note the port number of xdebug.remote_port. It should be "9000" by default..
  6. Note the IDE Key. Eventually, it should show "PHPSTORM" when you have successfully config Xdebug.
  7. To avoid complicating the config process, we are using all default values and directories. Once you've successfully configured and test driven the debugging feature, I reckon that it'll be easier to tune and customise your config.

Configuring PhpStorm 7.0

  1. Open PhpStorm.
  2. Goto Menubar > PhpStorm > Preferences > Project Settings > PHP.
  3. Reconfirm that you have config the "PHP language level" and "Interpreter" to your required PHP version.
  4. Click on "..." to open up a popup window.
  5. Under "PHP home", once again click on another "..." to open another window.
  6. Choose the correct PHP version via the Finder .
  7. For the default installation folder, it's at applications > MAMP > bin >php > php5.5.3(choose your version) > bin > click ok.
  8. Back at the previous popup window, you should see PhpStorm being able to detect the PHP version and the corresponding Xdebug ver. In my case it is PHP version 5.5.3 and Xdebug 2.2.3.
  9. Next, goto Menubar > Run > Edit Configutions > click "+" at top left-hand corner > PHP Web Application.
  10. Next, goto Menubar > PhpStorm > Preferences > Project Settings > PHP > Debug > DBGp Proxy.
  11. The "IDE Key" should show "PHPSTORM" as default.
  12. The "port" should show "9000" as default.1. Add Name.
  13. Choose current server from drop down menu or:
  14. Click on "...".
    • "Host" = localhost.
    • "Port" = 8888.
    • "Debugger" = Xdebug.
    • "Browser" = Chrome or any you would like (need to use corresponding browser debugging extension).

Installing Chrome's Xdebug Helper

  1. From Chrome, find Xdebug Helper and download + install it.
  2. You should see a grey bug icon at Chrome's address bar, right side.
  3. Right click on Bug icon > options > IDE Key > Dropdown menu > choose "PhpStorm" > close browser tab.
  4. Left Click on Bug icon > Debug.

Ready for Testdrive

  1. Now, from your PhpStorm's opened project, click on the "listen" icon. It's the icon with telephone icon + and "stop icon" + "Bug icon" all in one button. It's two buttons to the right of the debug button. The "stop icon" should disappear and replaced by a signals icon.
  2. Next, choose a few break points on your sample code
  3. Now, when you click on the debug button, Chrome should automatically open a new tab with your sample code/app running and suspended at your break point or point where you've configured to suspend at runtime by default.

Additional config: Administering Database right from PhpStorm

It's time to pop the champagne unless you want to do further setup to manage your database from within PhpStorm, which is another reason why IDE is great. You can refer to PhpStorm's very own online doc here.

Just to elaborate further on few of the procedures as mentioned in the doc that I thought might be helpful, here it goes:1. In PhpStorm, if you can't find the vertical "database" button at the right-hand-side, then simply click on a small button at the bottom-left-most corner. The button looks like a monitor icon. Doing that will toggle the vertical "database" button visible.

  1. Click on the vertical button of "database".
  2. Press COMD + N.
  3. From the dropdown menu, select new datasource.
  4. Under the first tab "Database" > JDBC driver files > select MySQL Connector/(some ver) > "Click here to download".
  5. At "Database URL", note that your url comprises:

    "hello_database" is the name of your database.
    8889 is the port number to your MySQL server.  Once again, 8889 is the default
  6. Config your database access credentials.

  7. If you don't have any existing db, then goto PhpMyAdmin to manually setup a new db and create new users with access credentials.
  8. Now back in PhpStorm, simply key in the same access credentials.
  9. Once your configurations are done correctly, you should see the database window populated by a list of your db tables.
  10. You can now manage your db directly from PhpStorm without having to do it separately from PhpMyAdmin.


The above steps are pretty lengthy, and this is the reason why I thought it might be helpful to some of you who might encounter some difficulties in the configurations. On the same note, if I have missed out any important steps, please feel free to add your comments. Hope this helps.

Update: Php5.53 seems to have a bug that does not allow Chrome to page-reload properly. For example, when I changed

from <?php echo 'Hello'?>
to <?php echo 'Hello Dale'?>

the word "Dale" does not refresh and appear on Chrome. My cache is disabled for dev just like any others would and I even tried Cache Killer for good measure. Finally, when I rolled back to php5.4.19 with it's corresponding Xdebug config, the refresh issue was no longer present. Let me know if you have a work around. Meanwhile, I'll have to make do with Php5.4.19.

Wednesday, March 31, 2021
answered 7 Months ago

You should ignore key-repeat events (with isARepeat true). Instead, when you get a key-down event, start a timer that fires however often you want to advance your game state. Advance the game state in that timer's firing code. When you get a key-up event, stop the timer.

Thursday, September 2, 2021
answered 2 Months ago

The information about approvals is stored in sqlite3 database:


The tables you're interested in are: kext_policy and kext_load_history_v3. E.g. here is how you can view the data and the table schema:

sqlite3 /var/db/SystemPolicyConfiguration/KextPolicy

sqlite> select * from kext_policy;
54GTJ2AU36|com.joshuawise.kexts.HoRNDIS|1|Joshua Wise|1

sqlite> .schema kext_policy
CREATE TABLE kext_policy ( team_id TEXT, bundle_id TEXT, allowed BOOLEAN, developer_name TEXT, flags INTEGER, PRIMARY KEY (team_id, bundle_id) );

Removing the approval is tricker, since the System Integrity Protection does not allow you to modify the database. So, you'd need to reboot into a recovery partition, or a different MacOS installation, then cd into the root of your volume, and run the commands like these (replace with your team_id, or use other criteria):

usr/bin/sqlite3 var/db/SystemPolicyConfiguration/KextPolicy
delete from kext_load_history_v3 where team_id='54GTJ2AU36';
delete from kext_policy where team_id='54GTJ2AU36';
Sunday, September 12, 2021
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :