0

On the server I had php scripts responsible for sending notifications to mobile phones. It runs well if the scripts are called from the same directory.

The problem is to call the scripts from cakePHP app.

I include the notifications script inside cakePHP function like this:

include $_SERVER['DOCUMENT_ROOT'].'/folder_name/Notifications.php';

When I call the script, I get the following warnings inside the scripts:

include_once(./db_connect.php) [function.include-once]: failed to open stream: No such file or directory [/home/username/public_html/gcm_server_php/db_functions.php

Warning (2): include_once() [function.include]: Failed opening './db_connect.php' for inclusion (include_path='/home/username/public_html/cake-dev/lib:.:/usr/lib/php:/usr/local/lib/php') [/home/username/public_html/gcm_server_php/db_functions.php, line 21]

And the following fatal error:

Error: Class 'DB_Connect' not found 
File: /home/username/public_html/gcm_server_php/db_functions.php    
Line: 25

Any help is much appreciated. Keep in mind that calling scripts from the same directory, everything runs smooth.

4

1 回答 1

0

整个应用程序中的所有包含链接都是错误的。需要做的是包括其他文件和绝对路径,如下所示:

包括 $_SERVER['DOCUMENT_ROOT'].'/folder_name/Notifications.php';

于 2013-11-14T17:26:41.753 回答