php-newbies Posted June 8, 2012 Share Posted June 8, 2012 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. Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/ Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 Where is the script calling the require located? Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352206 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 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. Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352209 Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 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'; Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352217 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 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. Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352220 Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 What is the error? Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352223 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 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 Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352226 Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 I think you are looking at the (edit: wrong) 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. Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352227 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 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 Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352232 Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 It doesn't have to be in pay_paypal.notify.php, it can be in any of the other 4 files you are including. Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352234 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 It doesn't have to be in pay_paypal.notify.php, it can be in any of the other 4 files you are including. thanks for your reply, what other 4 files you referring to? Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352236 Share on other sites More sharing options...
scootstah Posted June 8, 2012 Share Posted June 8, 2012 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"); Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352239 Share on other sites More sharing options...
php-newbies Posted June 8, 2012 Author Share Posted June 8, 2012 ok, I will go through those files to see if I can find the import.php and try commenting the line out. Will report back. Thanks for your time Link to comment https://forums.phpfreaks.com/topic/263859-require-once-vs-include-relative-php-path/#findComment-1352241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.