What are some common misconceptions about using SSH in PHP scripts for RaspberryPi projects?

One common misconception is that using SSH in PHP scripts for RaspberryPi projects is insecure. However, by properly setting up SSH keys and restricting access, you can securely use SSH in your PHP scripts. Another misconception is that SSH commands cannot be executed from PHP, but in reality, you can use functions like `ssh2_exec` to run SSH commands.

// Connect to SSH server
$connection = ssh2_connect('example.com', 22);
ssh2_auth_password($connection, 'username', 'password');

// Execute SSH command
$stream = ssh2_exec($connection, 'ls -la');
stream_set_blocking($stream, true);
$output = stream_get_contents($stream);

// Close the connection
fclose($stream);