Can't change linux user password with php script [closed]

Solution 1:

The solution was to comment out ProtectSystem=full in php-fpm.service unit:

# Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit.
#ProtectSystem=full