Jupyter PHP Kernel on MacOS in 2022
Published on .
Recently, I wanted to muck around with PHP interactively in Jupyter with https://github.com/Rabrennie/jupyter-php-kernel and had a tough time getting it configured on MacOS Monterey 12.6 due to PATH issues which manifested as env: php: No such file or directory
entries in the jupyter log …but PHP was in my PATH so I wasn’t sure how to proceed.
Finally I noticed the following in the log, so I could see the PATH being used (and rather than fix it) I just worked around it with the following:
ln -s /opt/homebrew/Cellar/php/8.1.13/bin/php /Users/ntaylor/.pyenv/versions/3.11.0/bin
ln -s /Users/ntaylor/.composer/vendor/bin/jupyter-php-kernel /Users/ntaylor/.pyenv/versions/3.11.0/bin
That was that.
[E 2022-11-26 21:40:28.983 ServerApp] Failed to run command:
['jupyter-php-kernel', '-r', '-c', '/Users/ntaylor/Library/Jupyter/runtime/kernel-a6f883a5-1bee-4c2b-9ca8-1aef8a22cc1d.json']
PATH='/Users/ntaylor/.pyenv/versions/3.11.0/bin:/opt/homebrew/Cellar/pyenv/HEAD-44510a6/libexec:/opt/homebrew/Cellar/pyenv/HEAD-44510a6/plugins/python-build/bin:/usr/bin:/bin:/usr/sbin:/sbin'
with kwargs:
{'stdin': -1, 'stdout': None, 'stderr': None, 'cwd': '/Users/ntaylor/notebooks/workbench', 'start_new_session': True}