2

I have problem that on server include() function does not want to work and I have no idea why?

I have:

 if (file_exists('/home/p002/htdocs/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php')) {
    echo "1 works";
} else {
    echo "The file 1 does not exist";
}

if(include "$_SERVER[DOCUMENT_ROOT]/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php" == 'OK')
{
    echo 'INCLUDE 1 works';
}
else
{
    echo 'Step 1 fail';
}
if(include '/home/p002/htdocs/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php' == 'OK')
{
    echo 'INCLUDE 2 works';
}
else
{
    echo 'Step 2 fail';
}

It returns: 1 works Step 1 fail Step 2 fail I have no idea how to force it to work. HELP I use zend framework and this file is in the library (parallel to zend -libraries - directory but it does not want to work too without the include directory :/


It is really strange for me as when I add:

include ("/home/p002/htdocs/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php");

And it is correct path I have only blank page! But when I add:

include ("/homedddd/p002/htdocs/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php");

And it is wrong path the page is not blank, it looks like working OK. It mean something is wrong with this IntelliSMS library it does not work with my server but I do not know why? Probably server blocking sending sms or something? Do you have any idea? This library is from http://intellisms.co.uk/sms-gateway/php-sdk/ Maybe there is problem that it needs the OpenSSL extension module? What should I do it to start works?

4

4 に答える 4

1

In the first block of code you found out, that /home/p002/htdocs/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php exists. When you try to include this file, you never use the exact same string. If you do, it should work.

Edit: You tried that and it failed. In that case it looks like a permission issue. If you do not have read permissions on that file, the first test will work, but including the file will fail.

于 2011-04-21T22:02:27.043 に答える
0

これがあなたが間違っていることです。実際には、すべての試行に FALSE を含めようとしていました。このようなことをする

include '/path/to/file.php' == "OK";

それに等しい

include FALSE;

これはおそらくあなたがやりたかったことです

if((include '/path/to/file.php') == "OK") { echo("works"); }

パスが非常に長いため、他の SO ユーザーはこの事実を見落としており、比較がコード ブロックに隠されています。

于 2011-04-21T22:31:00.100 に答える
0

パス名に \ バックスラッシュを使用しないでください。/Windows サーバーと Un*x サーバーの両方で機能するスラッシュを使用します。

また、ベース ディレクトリ名が両方のサーバーで同じになることはほとんどありません。再配置可能にして、次のように置き換え/home/p003/htdocsますDOCUMENT_ROOT

include "$_SERVER[DOCUMENT_ROOT]/Project2/library/IntelliSMS/SendScripts/IntelliSMS.php";

二重引用符に注意してください。

可能であれば、大文字と小文字が混在するファイル名を避けることをお勧めします。

于 2011-04-21T22:06:21.257 に答える
0

スラッシュを変更しました。これは問題になる可能性があります。

于 2011-04-21T21:59:35.737 に答える