If you are managed multiple PHP versions with phpenv, I’ll show you how to use the NetBeans with PHP tools such as PHPUnit.
How to use the php in phpenv environment
- Open “Preferences” > “PHP” > “General”
- “PHP 5 Interpeter” set to phpenv’s PHP path. eg:
How to use the PHPUnit in phpenv environment
1. Create custom scripts
When you specify path in phpenv environment (eg.
/usr/local/phpenv/shims/phpunit) to NetBeans, it is not recognized as a shell script.
So, let create a file with the extension
XDEBUG_CONFIG="idekey=netbeans-xdebug" /usr/local/phpenv/shims/phpunit "$@"
Create this script file to
/usr/local/phpenv/bin/phpunit.sh. and give a execute privileges.
XDEBUG_CONFIG is a environment variable for xdebug.
phpunit-skelgen as well.
2. Specify custom scripts path
- Open “Preferences” > “PHP” > “Frameworks & Tools”
- Select “PHPUnit”
- Set custom script paths, it’s you created above.
Another tools with phpenv
Also tools such as PHPMD and PHPCS, you can use phpenv environment in the NetBeans by providing a script file with the extension
.sh in this way.
Let’s enjoy NetBeans with phpenv.