$ path in Netbeans does not contain / usr / local / bin when running / debugging php

I am working with Netbeans 8.0.2 on a Mac. I have problems with exec statements. Inside netbeans, it seems that he cannot find the commands available in the terminal.

For example, I have this run statement:

exec('mongorestore --host='.$this->host.' -d '.$this->db_name.' --dir '.$this->schemaPath);

If I run: php restore.phpfrom the terminal, it starts without incident and imports the data. However, if I run / debug / unittest from the netbeans output window, you will see:

sh: mongorestore: command not found

Other commands, such as mysqldump, also have this problem. How can I make sure this command works from Netbeans?

To be clear, I can run these commands in a terminal in netbeans, the problem only occurs if I run the / debug / unittest php file.

UPDATE: After running another test, I found that the path variable is different for Netbeans.

: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin netbeans: /usr/bin:/bin:/usr/sbin:/sbin

+4

Source: https://habr.com/ru/post/1614544/


All Articles