Jump to content

require once vs include Relative php path


php-newbies

Recommended Posts

I believe there is a problem with the path to this file. what would be the alternative way to define the path?

 

require_once(dirname(__FILE__)."/pay_paypal.loadframework.php");

 

The physical path to this file is located in my root folder. i.e  root/components/com_ad/plugins/payment/pay_paypal.loadframework.php

 

is it possible to change require_once to include the relative path and how do I do this?

 

Many thanks in advance.

Where is the script calling the require located?

 

Thanks this is the script "pay_paypal.notify.php" below

 

<?php

// no direct access
    header("Status: 200 OK");

    require_once(dirname(__FILE__)."/pay_paypal.loadframework.php");
    $database = & JFactory::getDBO();
    



    require_once(JPATH_ADMINISTRATOR.'/components/com_adsman/tables/addsman.php');
    require_once(JPATH_ADMINISTRATOR.'/components/com_adsman/tables/adsuser.php');
    require_once(dirname(__FILE__)."/pay_paypal.php");

$payment = new pay_paypal($database);
$payment->ipn($_REQUEST);

?>

 

Normally if the script runs ok, it should give me a blank page but will log it the backend

http://tt.easy2sell.net/components/com_adsman/plugins/payment/pay_paypal.notify.php

 

 

Many thanks for your help in advance.

If they are in the same directory you don't need to supply a path, just give the file name.

require_once 'pay_paypal.loadframework.php';

 

Thanks yes, they are in the same directory/folder. Have tried with brackets require_once ('pay_paypal.loadframework.php');    or without brackets, require_once 'pay_paypal.loadframework.php';but still gives error. I am really not sure what is causing it.

 

Thanks once again.

What is the error?

 

 

Warning: require_once(/home/bgcomp/public_html/tt/components/com_adsman/plugins/payment/../../../../../../libraries/import.php) [function.require-once]: failed to open stream: No such file or directory in /home/bgcomp/public_html/tt/includes/framework.php on line 39

 

Fatal error: require_once() [function.require]: Failed opening required '/home/bgcomp/public_html/tt/components/com_adsman/plugins/payment/../../../../../../libraries/import.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bgcomp/public_html/tt/includes/framework.php on line 39

 

 

This the url: http://tt.easy2sell.net/components/com_adsman/plugins/payment/pay_paypal.notify.php

 

I think you are looking at the file. You are trying to include import.php from framework.php. I don't know what this has to do with the files you mentioned.

 

This is the problem. I do not know why the script will invoke the  include import.php from framework.php when it is not even mentioned in the pay_paypal.notify.php

 

http://tt.easy2sell.net/components/com_adsman/plugins/payment/pay_paypal.notify.php

require_once(dirname(__FILE__)."/pay_paypal.loadframework.php");
require_once(JPATH_ADMINISTRATOR.'/components/com_adsman/tables/addsman.php');
require_once(JPATH_ADMINISTRATOR.'/components/com_adsman/tables/adsuser.php');
require_once(dirname(__FILE__)."/pay_paypal.php");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.