-1
我有這樣的代碼併兼具本地(XAMPP)服務器和VPS上運行相同的twilio.php庫:錯誤:未能打開流:沒有這樣的文件或目錄
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;
?>
的代碼完全運行在本地,但我VPS輸出以下錯誤:
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
本地,腳本和twilio libary位於
C:\xampp\htdocs\mysql-monitor\
在VPS,它們位於
/var/www/html/thsportsmassagetherapy.com/mysql-monitor/
這是有可能的路徑錯誤或問題,我的PHP設置?
autoload.php有哪些權限?如果您可以手動瀏覽到該文件,則可能是燙髮問題。只需首先想到... – brad
'require'/twilio-php/twilio/autoload.php';'所以使用完整的服務器路徑,然後'require'/ var/www/html/twilio-php(或其他文件夾).. ......';就像你提到過VPS的事情一樣。 –
或..相對鏈接'require'./twilio-php/twilio/autoload.php'; '假設twillio-php和這個腳本在同一個目錄中 –