Hi, I am a new Drupal user. I am really excited to try out the media mover module. As a test of this module, I am trying to upload a .AVI file, as is, to my S3 account. When the upload to S3 piece runs I get the following error: warning: in_array() [function.in-array]: Wrong datatype for second argument in /usr/local/apache/htdocs/modules/media_mover/mm_s3/mm_s3.module on line 243. I have tried using an existing S3 bucket name, and also a bucket name that doesn't exist.

I am running Drupal 5.6. Any help is greatly appreciated. Thanks

CommentFileSizeAuthor
#9 PEAR.php_.txt29.43 KBfglynn

Comments

arthurf’s picture

You might want to give the latest code from CVS a try. There are a number of fixes that I did that haven't hit a stable release. That being said, is the code actually stopping, or are you just getting a warning?

fglynn’s picture

Hi, I downloaded the latest drupal5 code from CVS. I tried running the S3 test. It is failing in the Storage3.php mkBucket method. Is there a way I can get you better logs?

arthurf’s picture

There is an older version of the test which uses a standard name for the bucket. This is bad because many people may have used it, which creates name collisions on S3. I changed the name of that bucket to use the name you set in admin/media_mover/settings

Please check the test .inc file and see if it's using the variable, if it's not update to the latest cvs again, and try that out.

Also if you have CiviCRM installed, it comes with an older version of Request.php which breaks S3. You need to replace that version of Request.php with a more modern one, or the one in the drivers file that you downloaded.

fglynn’s picture

My test.inc is using the variable based on what I have in admin/media_mover/settings. I also tried hard coding the bucket name. But no luck.
I do not have CiviCRM installed.
One thing I noticed was I had to get the PEAR libraries separate from the DRIVERS tar, and my PHP installation. Media Mover initially complained that I did not have the right includes, but after I downloaded them from www.php.net it stopped complaining.

arthurf’s picture

When you say:

It is failing in the Storage3.php mkBucket method

Can you give me the exact error?

fglynn’s picture

mm_s3_test prints "Could Not Make Bucket Array ( [int] => ) Removed Bucket, Please Try Again" to the screen. Is this the error you are looking for?

arthurf’s picture

What's the name of the bucket it's trying to create? Is the first line of code in mm_s3_test.inc :

$testBucket = variable_get('mm_s3_bucket', str_replace(" ", "_", $conf['site_name'])) .'_test';

If it's not, then either set the $testBucket to something that is really unique (eg: $testBucket = 'a2s3d4f5g7'; ) or change the name of the bucket in your admin/media_mover/settings

I think you're getting a name space collision.

arthurf’s picture

I've tried to improve the output from the test- grab the test file from cvs and see if that works better for you. The output should be a bit better to understand :)

fglynn’s picture

StatusFileSize
new29.43 KB

Hi, Thanks for the help with this. Here's the current output I am getting:

The following buckets currently exist on the server:
----------------------------------
----------------------------------
could not create bucket
Could Not Put File Array ( [int] => ) Removed bucket 'fergalglynnbucket12_test'

And in the Drupal logs I get:
Invalid argument supplied for foreach() in /usr/local/apache/htdocs/modules/media_mover/mm_s3/mm_s3_test.inc on line 49.

I'm still wondering if there is something up with the version of PEAR.php I am using. I have placed PEAR.php in the drivers directory /usr/local/apache/htdocs/modules/media_mover/drivers. But could it be that this is the wrong version? I had to get PEAR.php seperate from the rest of the S3 drivers. I have attached the PEAR.php I am using.

arthurf’s picture

It could be the pear libraries that you installed, I'm not sure. You could try removing the versions that you installed and see if that improves things.

fglynn’s picture

Thanks for your continued help. I'm getting really confused. I got the latest PEAR.php but still no luck. I also set up Drupal and Media Mover on a windows machine to see if that would work... no luck...same message is printed to screen. I also entered in an incorrect S3 key, just to see if the output messages would be any different ...nope.... I still get the same messages.
Is there anyway you can make available a Media Mover directory, including the drivers directory, that you know runs in your environment? Thanks.

arthurf’s picture

Are you using the drivers file from here: http://24b6.net/files/drivers.tgz? Those are the files I use with a standard installation and I don't have any issues. What is the environment you're doing this in? What version of php?

fglynn’s picture

Yes, I am using those exact drivers. I am running Apache/2.0.63 PHP/5.2.5 on CentOS. I extract the drivers to ../modules/media_mover/drivers

I am running the media_mover cvs code from the Drupal5 branch

arthurf’s picture

Ok, I've played around on a RH box and have lots of issues (probably because it's a plesk box). Here's what I did to change things:

1) made sure that pear was in my php include list in the vhost.conf:


php_admin_value open_basedir "/var/www/vhosts/SITENAME/httpdocs:/tmp:/usr/share/pear"
php_admin_value include_path "/var/www/vhosts/SITENAME/httpdocs:/php/includes:/usr/share/pear"
php_admin_flag safe_mode off

This maybe overreaching, not sure.

2) Changed the includes on the Request.php file:
require_once 'PEAR.php';
//require_once 'Net/Socket.php';
//require_once 'Net/URL.php';

Since these files have already been included by Storage3.php, they aren't needed. I checked my pear channel to make sure I'm not using my local versions:

Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.1 stable
Console_Getopt 1.2 stable
Crypt_HMAC 1.0.1 stable
PEAR 1.4.11 stable
XML_RPC 1.5.1 stable

Doing these things resolved things for me. I'll change the files slightly in the drivers download

fglynn’s picture

Thanks for all your support with this. I followed your instructions but it was still bombing out at the same place. I also tried re-compiling and re-installing PHP with PEAR but this didn't work. So, I gave up on CentOS and move to Ubuntu. Everything worked straight away! I'm delighted.

arthurf’s picture

Status: Active » Closed (fixed)

Well glad you moved over to a better operating system :) I'm guessing the issue you were having is related to how the openbase dir is defined, but nonetheless, glad things are working for you now!