1

I have downloaded this API.

If you go to lib/Paypal/Profile/Handler/Array.php you will find this line:

require_once 'PayPal.php';

Since the PayPal.php file is in the lib/ folder, I expected something like this:

require_once '../../../../PayPal.php'

So...where is set what is the "root" folder of the API?

NOTE: my question has a reason: I'm trying to know why I'm getting an error like this:

Warning: require_once(PayPal.php): failed to open stream: No such file or directory in /home/me/app1/plugins/mbpPlatformFrontendPlugin/lib/paypal/PayPal/Profile/Handler/Array.php on line 9

Regards

Javi

mellamokb
  • 56,094
  • 12
  • 110
  • 136
tirenweb
  • 30,963
  • 73
  • 183
  • 303

4 Answers4

2

When you run the built-in installer (/install.php), it adds code to set the include_path here:

install.php[130-135]

$code = "<?php\n" .
    "//*******************************************\n" .
    "// AUTO-GENERATED include for PayPal PHP SDK\n" .
    "// Created by install.php on $stamp\n" .
    "//*******************************************\n\n" .
    "set_include_path('$sdk_dir' . DIRECTORY_SEPARATOR . '" . $libdir . "' . PATH_SEPARATOR . get_include_path());\n";

Which is why the README.html file tells you to run the included installer in order to use the samples.

mellamokb
  • 56,094
  • 12
  • 110
  • 136
1

Try to find this:

Set Include Path

Danzan
  • 958
  • 5
  • 8
0

PHP has what's called an include_path that specifies where it defaults to looking for files to include/require. You can set it in your php.ini or in your code using set_include_path().

Crashspeeder
  • 4,291
  • 2
  • 16
  • 21
0

I'm guessing the Array.php file is itself included by another file, running from somewhere else (probably the root).

When you include (or require) another php-file, it will execute with the same path as the script that included it (which may intern be included by, and thus executed in the path of, yet another script).

Adrian Schmidt
  • 1,886
  • 22
  • 35