I tried PHP 7.2.18 && Nodejs 10.15.3
Still not working
I don’t know if it’s a permission issue. . .
Have you tried disabling SELinux with sudo setenforce 0
?
I did not install apache.
I use nginx
What user is nginx running on? Can try to get the version as this user. For www-data
for example : sudo -u www-data node -v
This would at least point out if it’s related to system / user, or PHP exec
function.
I believe SELinux could be causing issues even if you are running nginx. I am not sure Security-Enhanced Linux has anything to do with Apache specifically? This is the first suggestion in the troubleshooting section for CentOS https://learn.userfrosting.com/installation/other-situations/centos
Then what should I do? Operating Apache that doesn’t exist?
I am talking about this:
Hey, you are talking about this! I want to try it, but can you tell me how to view the current settings?
I’ve just made a quick test using a CentOS 7 Vagrant Box I found online and everything works great after updating NodeJS using theses instructions.
So it’s definitively an issue on your side, not UF one. Check again for permissions issue, or PHP (CLI) config. Might have a setting in your PHP that messes with the exec
function, as your issue is strictly related to this core PHP function.
A simple test to see if this work would be to execute this command directly on the command line :
echo "<?php echo exec('node -v'); ?>" | php
Which made me realize, Apache or Nginx won’t have anything to do with your issue. The webserver don’t intervene in the CLI / Bakery execution. Only your PHP CLI version will (and config wise, it can be different from fpm
PHP config).
EDIT: This will also apply to permissions. Bakery command are executed with the same permissions as the user that calls the command. So nothing to do with the www
user as I previously thought.
Thanks, the exec function is indeed disabled, resulting in no version information for Nodejs being detected.
It is also recommended to add a function function judgment or alternative (if any).