php5-xcache

Bradley Giesbrecht pixilla at macports.org
Sun Nov 6 07:00:17 PST 2011


On Nov 6, 2011, at 6:20 AM, Phil Dobbin wrote:

> On 6/11/11 13:38, "Bradley Giesbrecht" <pixilla at macports.org> wrote:
> 
>> What is the command here:
>> /opt/local/apache2/htdocs/cli-s3_get_urls_for_uploads.php: line 47
>> 
>> This should work:
>> require_once("AWSSDKforPHP/sdk.class.php");
> 
> Hi, Bradley.
> 
> That did indeed work. As I think I said before & unfortunately forgot about
> myself, all the php files in the SDK are written as if the AWSSDKforPHP
> directory are placed in ~/ i.e.

I do not think this is the case. I have not used AWSSDK but:
$ port contents pear-AWSSDKforPHP | grep .php | xargs grep -E "(require|include)_once"
...
/opt/local/lib/php/pear/AWSSDKforPHP/sdk.class.php:	include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php';
/opt/local/lib/php/pear/AWSSDKforPHP/sdk.class.php:	include_once getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php';
...

Note that include_once unlike require_once does not error file does not exist.
/opt/local/lib/php/pear/AWSSDKforPHP/sdk.class.php: line 21
...
// Look for include file in the same directory (e.g. `./config.inc.php`).
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php'))
{
	include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php';
}
// Fallback to `~/.aws/sdk/config.inc.php`
elseif (getenv('HOME') && file_exists(getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php'))
{
	include_once getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php';
}
...

What ever is supposed to be in config.inc.php could be put anywhere that is parsed by php before including AWSSDKforPHP/sdk.class.php.
For example you could put a file in your docroot and do this:
require_once("config.inc.php");
require_once("AWSSDKforPHP/sdk.class.php");


Again, I am not familiar with AWSSDK, I have only had a quick glance.


Regards,
Bradley Giesbrecht (pixilla)






More information about the macports-users mailing list