News:

Support the VirtueMart project and become a member

Main Menu

403 Forbidden on Product page

Started by marianus, June 02, 2012, 14:27:15 PM

Previous topic - Next topic

marianus

Hello!

Firstly, sorry for my English!

I use VM 2.0.6 and Joomla 2.5.4.

Yesterday, I put this code on default.php -> productdetails ->com_virtuemart ->html -> my_template: <br/><strong>Code: </strong><?php echo $this->product->product_sku ?>

Eg:

// Product Price
if ($this->show_prices) { ?>
</div><div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
<?php 
if ($this->product->product_unit && VmConfig::get 'vm_price_show_packaging_pricelabel' )) {
echo "<strong>" JText::'COM_VIRTUEMART_CART_PRICE_PER_UNIT' ) . ' (' $this->product->product_unit "):</strong>";
} else {
echo "<strong>" JText::'COM_VIRTUEMART_CART_PRICE' ) . "</strong>";
}
if ($this->showBasePrice) {
echo $this->currency->createPriceDiv 'basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices );
echo $this->currency->createPriceDiv 'basePriceVariant''COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT'$this->product->prices );
}
echo $this->currency->createPriceDiv 'variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices );
echo $this->currency->createPriceDiv 'basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$this->product->prices );
echo $this->currency->createPriceDiv 'discountedPriceWithoutTax''COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE'$this->product->prices );
echo $this->currency->createPriceDiv 'salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices );
echo $this->currency->createPriceDiv 'salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices );
echo $this->currency->createPriceDiv 'priceWithoutTax''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX'$this->product->prices );
echo $this->currency->createPriceDiv 'discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices );
echo $this->currency->createPriceDiv 'taxAmount''COM_VIRTUEMART_PRODUCT_TAX_AMOUNT'$this->product->prices ); ?>
<br/><strong>Code: </strong><?php echo $this->product->product_sku ?>
</div>


This works ok, but today, when I try to save a new product in store, in Edit Product Page appears this error:


403 Forbidden

You don't have permission to access /administrator/index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.



I deleted the <br/><strong>Code:</strong> <?php echo $this->product->product_sku ?> from default.php, but the error appears.

How I can resolve that?

Thank You

sadrem

Hello,
Your changes in code does not connect to "403 Forbidden" error
It's Your server permission problems.

To solve You need to set files permissions like
:folders : 755  files 644

Quotefrom ssh
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Do not forget to change Message icon: to solved if Your problem solved.
p.s. Do not forget to change message icon to Solved.

marianus

Hello!

Thank You for Your answer! 
Where i find the ssh? In cPanel?
I'm a newbie :)
Thanks

sadrem

You need to check with your hosting provider how to enter ssh
p.s. Do not forget to change message icon to Solved.

Thomas Kuschel

#4
Hi Maurianus,
what sadrem said, you only have to change the access rights to your file.
On a unix server (eg. Linux), the apache Web server usually is the user "www-data".
If you change a file or add a file to the existing joomla tree, the file gets your rights with your logged-in user.
So you only have to go to the joomla directory and correct the owners of the file and directories or change the access rights (as in the mail before).

I prefer changing the owner with some files e.g. configuration.php set to read-only for user "www-data". (on my live system)
For testing only, you could use the mail before.: (hint: the line "cd /var/www" is your joomla folder)


cd /var/www
find . -print0|xargs -0 chown my_user_name:www-data --
find . -type f -print0|xargs -0 chmod 660 --
find . -type d -print0|xargs -0 chmod 770 --

this works with files named with spaces or file names beginning with '-' too.
my_user_name is your user name ;-)
You can put this into a bash script to automate this process.

Regards Thomas

marianus

Hi!

Thanks for Your answers!

I talked to the my hosting company and they suggested to restart the mod_security function from cpanel (I disabled the function and after 15 minutes I enabled again). And until now, its works.

And I verified the file permissions in my joomla folder and the all is correct: folder -755, file -644.

Thanks!