loading...
Cover image for PHP Error on OpenBSD: "env: php: No such file or directory"

PHP Error on OpenBSD: "env: php: No such file or directory"

nabbisen profile image Heddi Nabbisen ・1 min read

* The cover image is originally by 13smok and edited with great appreciation.


In OpenBSD, a symbolic link named php isn't created when installing PHP:

# pkg_add php

The result is:

$ ls -1 /usr/local/bin/php*
/usr/local/bin/php-7.3
/usr/local/bin/php-config-7.3
/usr/local/bin/phpize-7.3

It's OK because php-X.X works well in most cases:

$ php-7.3 /usr/local/libexec/composer.phar require drush/drush

$PATH missing php, however, sometimes occurs an unexpected error with some PHP modules such as Drush, a command line shell for Drupal CMS:

$ drush updatedb
env: php: No such file or directory

It tried to run php which was missed!

In such a case, creating the symlink is helpful:

# ln -s /usr/local/bin/php-7.3 /usr/local/bin/php

Then the error will be resolved:

$ drush updatedb
 [success] No pending updates.

Remove the additional symlink afterward as needed:

# rm /usr/local/bin/php

Thank you for your reading.
Happy computing :)

Posted on by:

nabbisen profile

Heddi Nabbisen

@nabbisen

An ICT designer/developer and a security monk. "With a cool brain and a warm heart", I am challenging unsolved problems in our society. I use OpenBSD/Rust/etc.

Discussion

markdown guide