Koozali.org: home of the SME Server

Cannot upload images to Ibay

Offline hardijs

  • ****
  • 77
  • +0/-0
gallery
« Reply #15 on: March 31, 2005, 04:22:21 PM »
Quote from: "edb"
What exactly did you do?

Code: [Select]

/sbin/e-smith/db accounts setprop gallery httpdAdvanced "php_admin_value upload_tmp_dir /home/e-smith/files/ibays/gallery/html/temp"

 
then
Quote

/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
and finally:
/etc/e-smith/events/actions/restart-httpd-graceful

then deleted everything in the gallery ibay (I know - quite an overkill)

the run the Knuddi install script again
so after a fresh configure I am doing my gallery uploads again

I know that I got an easy way as there are almost none gallery users and I did not need to import/copy them - so starting from scratch (or almost that) did work.

gavincowie

Cannot upload images to Ibay
« Reply #16 on: March 31, 2005, 11:34:33 PM »
Quote

edb wrote:
Quote
What exactly did you do?


You need to look for the references to the if statement that deals with "AuthName" in the template - if you add in the "if httpdAdvanced" lines after that if statement closed, that should get the advanced stuff to appear in the right place for the ibay declarations.

G[/quote]

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #17 on: April 01, 2005, 04:21:27 PM »
Quote
You need to look for the references to the if statement that deals with "AuthName" in the template


Here is my file, there are lots of places where it says "AuthName". Could you indicate in bold where I should add the line. Thanks

#------------------------------------------------------------
# Information bay directories
#------------------------------------------------------------

{
    use esmith::AccountsDB;
    my $adb = esmith::AccountsDB->open_ro();
    $OUT = "";
    foreach my $ibay ($adb->ibays)
    {
   my %properties = $ibay->props;
   my $key = $ibay->key;
   #------------------------------------------------------------
   # Figure out which combination of parameters to use. If
   # PublicAccess parameter is present, this is e-smith 4.0.
   # Otherwise, it's e-smith 3.0.
   #------------------------------------------------------------

   my $allow;
   my $pass;
   my $satisfy;
   
   if ($properties{'PublicAccess'})
   {
       if ($properties{'PublicAccess'} eq 'none')
       {
      next;
       }
       elsif ($properties{'PublicAccess'} eq 'local')
       {
      $allow   = $localAccess;
      $pass    = 0;
      $satisfy = 'all';
       }
       elsif ($properties{'PublicAccess'} eq 'local-pw')
       {
      $allow   = $localAccess;
      $pass    = 1;
      $satisfy = 'all';
       }
       elsif ($properties{'PublicAccess'} eq 'global')
       {
      $allow   = 'all';
      $pass    = 0;
      $satisfy = 'all';
       }
       elsif ($properties{'PublicAccess'} eq 'global-pw')
       {
      $allow   = 'all';
      $pass    = 1;
      $satisfy = 'all';
       }
       elsif ($properties{'PublicAccess'} eq 'global-pw-remote')
       {
      $allow   = $localAccess;
      $pass    = 1;
      $satisfy = 'any';
       }
   }
   elsif ($properties {'ReadAccess'} eq 'global')
   {
       if ($properties {'UsePassword'} eq 'yes')
       {
      $allow   = 'all';
      $pass    = 1;
      $satisfy = 'all';
       }
       else
       {
      $allow   = 'all';
      $pass    = 0;
      $satisfy = 'all';
       }
   }
   else
   {
       if ($properties {'UsePassword'} eq 'yes')
       {
      $allow   = $localAccess;
      $pass    = 1;
      $satisfy = 'all';
       }
       else
       {
      $allow   = $localAccess;
      $pass    = 0;
      $satisfy = 'all';
       }
   }


   my $dynamicContent = $properties{'CgiBin'} || "disabled";
   $OUT .= "\n";
   $OUT .= "#------------------------------------------------------------\n";
   $OUT .= "# $key ibay directories ($properties{'Name'})\n";
   $OUT .= "#------------------------------------------------------------\n";

   $OUT .= "\n";
   $OUT .= "<Directory /home/e-smith/files/ibays/$key/html>\n";
   $OUT .= "    Options Indexes\n";
   if ($dynamicContent eq 'enabled')
   {
       $OUT .= "    Options +Includes\n";
   }
   else
   {
       $OUT .= "    <FilesMatch \"\\.(php|php3|phtml)\$\">\n";
       $OUT .= "        order deny,allow\n";
       $OUT .= "        Deny from all\n";
       $OUT .= "    </FilesMatch>\n";
       $OUT .= "    Options +IncludesNOEXEC\n";
   }
   $OUT .= "    AllowOverride None\n";
   $OUT .= "    order deny,allow\n";
   $OUT .= "    deny from all\n";
   $OUT .= "    allow from $allow\n";
   if ($pass)
   {
       $OUT .= "    AuthName \"$properties{'Name'}\"\n";
       $OUT .= "    AuthType Basic\n";
       $OUT .= "    AuthExternal pwauth\n";
       $OUT .= "    require user $key\n";
       $OUT .= "    Satisfy $satisfy\n";
   }
   $OUT .= "</Directory>\n";

   $OUT .= "\n";
   $OUT .= "<Directory /home/e-smith/files/ibays/$key/cgi-bin>\n";
   if ($dynamicContent eq 'enabled')
   {
       $OUT .= "    Options ExecCGI\n";
   }
   $OUT .= "    AllowOverride None\n";
   $OUT .= "    order deny,allow\n";
   $OUT .= "    deny from all\n";
   $OUT .= "    allow from $allow\n";
   if ($pass)
   {
       $OUT .= "    AuthName \"$properties{'Name'}\"\n";
       $OUT .= "    AuthType Basic\n";
       $OUT .= "    AuthExternal pwauth\n";
       $OUT .= "    require user $key\n";
       $OUT .= "    Satisfy $satisfy\n";
   }
   $OUT .= "</Directory>\n";

   $OUT .= "\n";
   $OUT .= "<Directory /home/e-smith/files/ibays/$key/files>\n";
   $OUT .= "    AllowOverride None\n";
   $OUT .= "    order deny,allow\n";
   $OUT .= "    deny from all\n";
   $OUT .= "    allow from $allow\n";
   if ($pass)
   {
       $OUT .= "    AuthName \"$properties{'Name'}\"\n";
       $OUT .= "    AuthType Basic\n";
       $OUT .= "    AuthExternal pwauth\n";
       $OUT .= "    require user $key\n";
       $OUT .= "    Satisfy $satisfy\n";
   }
   $OUT .= "</Directory>\n";
    }
}
......

gavincowie

Cannot upload images to Ibay
« Reply #18 on: April 01, 2005, 07:29:48 PM »
$OUT .= " AllowOverride None\n";
$OUT .= " order deny,allow\n";
$OUT .= " deny from all\n";
$OUT .= " allow from $allow\n";
if ($pass)
{
$OUT .= " AuthName \"$properties{'Name'}\"\n";
$OUT .= " AuthType Basic\n";
$OUT .= " AuthExternal pwauth\n";
$OUT .= " require user $key\n";
$OUT .= " Satisfy $satisfy\n";
}
--- PUT IT IN HERE ---
$OUT .= "</Directory>\n";

$OUT .= "\n";
$OUT .= "<Directory /home/e-smith/files/ibays/$key/cgi-bin>\n";

But, change it from using "$result" to using "$OUT" - as $OUT is the string you are adding to and it is the one that is used to make the template.

G

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #19 on: April 04, 2005, 06:41:14 AM »
Thanks again Gavin.

That makes it crystal clear but unfortunately it still didn't work for my purposes. I have not however tried to do as Hardijs suggested and delete everything in the Ibay.

Ed
......

gavincowie

Cannot upload images to Ibay
« Reply #20 on: April 04, 2005, 06:30:57 PM »
Quote
That makes it crystal clear but unfortunately it still didn't work for my purposes.

Bugger! So what happened? did it even make the appropriate php configuration lines appear in /etc/httpd/conf/httpd.conf when you did the expand template?

G

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #21 on: April 04, 2005, 09:22:22 PM »
Quote
Bugger! So what happened? did it even make the appropriate php configuration lines appear in /etc/httpd/conf/httpd.conf when you did the expand template?


Here is the section of the file that was appended:

<Directory /home/e-smith/files/ibays/store/cgi-bin>
    Options ExecCGI
    AllowOverride None
    order deny,allow
    deny from all
    allow from all
#   Advanced Properties
Options Indexes Includes FollowSymLinks
</Directory>

I did not put in the # sign next to Advanced Properties, this was done automatically.
If I try to remove the coment and restart httpd I get an error
[root@mail root]# service httpd restart
Stopping httpd:                                            [   OK   ]
Starting httpd: Syntax error on line 1374 of /etc/httpd/conf/httpd.conf:
Invalid command 'Advanced', perhaps mis-spelled or defined by a module not included in the server configuration
                                                           [ FAILED ]

Appears to be something wrong with the syntax.
......

gavincowie

Cannot upload images to Ibay
« Reply #22 on: April 04, 2005, 09:48:15 PM »
Quote
<Directory /home/e-smith/files/ibays/store/cgi-bin>
Options ExecCGI
AllowOverride None
order deny,allow
deny from all
allow from all
# Advanced Properties
Options Indexes Includes FollowSymLinks
</Directory>


First, the # Advanced Properties line is just a comment so you can know what the line below is for. you can leave it there without issue.

Second, it appears you pasted in the wrong place? you added the httpdadvanced code inside the "cgi-bin Directory" declaration:
$OUT .= "<Directory /home/e-smith/files/ibays/$key/cgi-bin>\n";

instead of inside the "html Directory" declaration:
$OUT .= "<Directory /home/e-smith/files/ibays/$key/html>\n";

So unless you *meant* to apply these options to the cgi-bin instead of the html directory i would refer back to my posting about exactly where to insert the httpdAdvanced fragment and change the location of the paste.

Also, if you are wanting to specify *additional* apache Options directives, you will have to add '+' signs to them, e.g.:
Options +FollowSymLinks

Finally, judging by the full template code you originally pasted, the "Indexes" and "Includes" directives are already there - you should get away with just setting the httpdAdvanced value to the example line above.

Fun eh?

G

Offline edb

  • *
  • 548
  • +0/-0
Cannot upload images to Ibay
« Reply #23 on: April 04, 2005, 10:45:01 PM »
Thanks for pointing that out Gavin.

That was pretty stupid of me to overlook that.

Ok I added the /sbin/e-smith/db accounts setprop store httpdAdvanced "Options Indexes Includes FollowSymLinks" command without realizing that it was just an example in Dan's instructions. So how do I reverse the command now that it is added to the httpd.conf file?

Also, I tried to upload an image again after editing the file as you pointed out but still no go. I'll have to touch base with the programmer of the ecommerce package to see if there maybe something else but they told me that they don't support my SME server config (due to all the templating stuff).
......

gavincowie

Cannot upload images to Ibay
« Reply #24 on: April 04, 2005, 10:55:41 PM »
Quote
Ok I added the /sbin/e-smith/db accounts setprop store httpdAdvanced "Options Indexes Includes FollowSymLinks" command without realizing that it was just an example in Dan's instructions. So how do I reverse the command now that it is added to the httpd.conf file?


The beauty of the e-smith db + templates system - just do it again, but with the value you want. e.g.

/sbin/e-smith/db accounts setprop store httpdAdvanced "Options +FollowSymLinks"

then perform the expand template again :
/sbin/e-esmith/expand-template /etc/httpd/conf/httpd.conf

the do the restarting of apache command.

G

Offline edb

  • *
  • 548
  • +0/-0
Uploading I mages to IBay - Issue Resolved
« Reply #25 on: April 10, 2005, 07:48:23 PM »
Ok, I found the answer to my uploading images issue.

It involves two commands at the server:

# /sbin/e-smith/db accounts setprop store PHPBaseDir /home/e-smith/files/ibays/youribayname/:/tmp

# /sbin/e-smith/signal-event ibay-modify youribayname

These two commands solved my issue.

I can now browse for the images, link them with my products and have the images actually appear on the site.  ;-) :pint:

Here is the link that I viewed to find the answer:
http://forums.contribs.org/index.php?topic=21553.msg96897#msg96897

Hope this will help someone else that is having the same issue.

Thanks to all for your replies to this thread.

BTW Gavin you were right on with your initial posts except that the path to /tmp may not have been exactly correct and I didn't need the advanced stuff.

Ed
......

Offline arne

  • *****
  • 1,116
  • +0/-4
Cannot upload images to Ibay
« Reply #26 on: April 10, 2005, 10:58:38 PM »
"Can not upload" .. this is a rather well known issue about the SME server. The SME has for years used a PHP chroot that have made it imposible to transfer files from the temporary upload area to the webserver file area. Reason: Security.

One easy solution: To unlock the PHP croot, wich will reduce the overall security of your system.

Have not actually tried this on newer versions than 6.0.1, but guess it still wil work.

Don't have my notes for "how to unlock the php chroot", but I have answered it out some times before.

After opening the PHP croot, it does not use to be any problem about making uploads etc. The disadvantage is that php scripts also might have the freedom to reach areas of your computer where it could make some damage. It will be less secure.

Another idea is to make some minor changes to the templates for the php.ini file, so it will accept bigger size of the uploadable objects, etc.
......

actronzs

Re: Cannot upload images to Ibay
« Reply #27 on: January 31, 2006, 10:06:04 PM »
Quote from: "edb"
I cannot seem to upload any images to my ibay.
Is this another template fragment issue or something cause it works fine in my primary bay. Thanks

Ed


Hi Ed,

on my SME ReleaseVersion=6.0.1-01 i use this:

/sbin/e-smith/db accounts getprop Primary PHPBaseDir (just for information)
/sbin/e-smith/db accounts setprop Primary PHPBaseDir /tmp:/home/e-smith/files/ibays/Primary (the ibay in which your Cerberus resides)
/sbin/e-smith/signal-event ibay-modify Primary
service httpd restart

Do:
ls /etc/e-smith/templates-custom/etc/php.ini (to make sure it exists)

Do:
cp /etc/e-smith/templates/etc/php.ini/50PathsDirectories /etc/e-smith/templates-custom/etc/php.ini

Run:
pico /etc/e-smith/templates-custom/etc/php.ini/50PathsDirectories

Add this value to the file:
upload_tmp_dir = /tmp

Save the file

Run:
/sbin/e-smith/expand-template /etc/php.ini

Run:
service httpd restart

zoran