I have this code and the same twilio.php library running on both a local (XAMPP) server and a VPS:
checkConnection.php
<?php
// Include Twilio PHP Library here
require '/twilio-php/twilio/autoload.php';
use Twilio\Rest\Client;
$sid = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // Your Account SID from www.twilio.com/console
$token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; // Your Auth Token from www.twilio.com/console
$client = new Twilio\Rest\Client($sid, $token);
$message = $client->messages->create(
'XXXXXXXXXXXXX', // Text this number
array(
'from' => 'XXXXXXXXXXXXX', // From a valid Twilio number
'body' => 'MySQL down!'
)
);
print $message->sid;
?>
The code runs perfectly locally, but my VPS outputs the following errors:
PHP Warning: require(/twilio-php/twilio/autoload.php): failed to open stream: No such file or directory in /var/www/html/thsportsmassagetherapy.com/mysql-monitor/checkConnection.php on line 4
PHP Fatal error: require(): Failed opening required '/twilio-php/twilio/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in **/var/www/html/thsportsmassagetherapy.com/mysql-monitor/checkConnection.php** on line 4
Locally, the script and twilio libary are located at
C:\xampp\htdocs\mysql-monitor\
On the VPS, they are located at
/var/www/html/thsportsmassagetherapy.com/mysql-monitor/
Is this likely a path error or a problem with my PHP settings?