Images don't show up in Magento Product Information Page

by cliper Thursday, January 27, 2011 10:22 AM

Late yesterday, we're working on something we don't expect in magento. Looking into the problem is very frustrating because we really don't have any clue what just happened until we found out that its just a persmission problem.

This might occur to you when you want to move a magento site to other existing instance (site) of magento. If you've been to magento, you know this already. In our case, we manually copied the media folder under the root directory of magento to the target instance of magento. Now, the previous media dir has "cache" folder already since it has been running for a long time now.

This cache folder is created on-the-fly when we tried to visit product information so that when you get back, it will reuse the same pictures together with your active session in the server-side.

Now, what just happened when we transferred the pictures in the target instance using "cp -r" in linux is that it resets the permissions of the folder. So eventually, the web-server and php can't right in it.

So our quick solution is we chowned the folder to its same user of the target folder. in the example it is "user" and a group "www-data". We also chowned the folder to 777 since its not that visible to public and for us to really make sure it is writable for any users.

> chown -R user:www-data cache/
> chmod -R 777 cache/

Anytime you can adjust the permissions like change to 775 or 755. And for this problem, it works and it solved our 24 horurs problem.

 

...

Tags:

Linux | Magento | PHP | Tips/Tricks

Get Magento’s database configuration

by cliper Tuesday, December 07, 2010 5:58 PM

On Linux, make a php file anywhere in your filesystem while including the magento Mage file.

<?php

require_once "/home/cliper/magento/app/Mage.php";

Mage::app();

$config  = Mage::getConfig()->getResourceConnectionConfig("default_setup");

$dbinfo = array(“host” => $config->host,
                “user” => $config->username,
                “pass” => $config->password,
                “dbname” => $config->dbname
);
?>

 

 

where /home/cliper/magento/ is your magento absolute path.

In windows, change the directory like:

require_once “C:\magento\path\app\Mage.php”;

You can then use the array like:

echo $dbinfo[“host”];

 

Tags: ,

Code Snippets | Magento | PHP | Tips/Tricks

Rebuilt Magento Indexes in terminal with php-cli

by cliper Tuesday, December 07, 2010 5:25 PM

 

For the past 6 months, had been doing a lot of work with Magento. I’ve notice that the more I know the whole thing, the more I don’t want to share about it. Well, I still like to share some things though… so now it’s time to give some tips/tricks…

In your terminal do:

cd /magento/shop/path/shell/

where “/magento/shop/path” is your magento rooth path. For e.g. (in live terminal)

user:~$ cd /home/cliper/magento/shell/

after that, you can run the indexer by doing:

php indexer.php reindexall

that will re-index all available indexes in magento.

Well, you can always run it in one command like:

php /home/cliper/magento/shell/indexer.php reindexall

For help on how to use the indexer and available arguments do:

php indexer.php

For a list of available indexes do:

php indexer.php info

and you should be able to see a list of indexes something like this:

catalog_product_attribute     Product Attributes

catalog_product_price         Product Prices

...                           ...

 

 

About the author

Author's PhotoI enjoy web developing and would like to share my thoughts of it.

Send mailE-mail me

Most comments

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar