Today (at the time of writing) I tried to install Magento 1.7.0.0 via SSH as ‘root’ user using following bash script:
#!/bin/bash
wget http://www.magentocommerce.com/downloads/assets/1.7.0.0/magento-1.7.0.0.tar.gz
wget http://www.magentocommerce.com/downloads/assets/1.2.0/magento-sample-data-1.2.0.tar.gz
tar -zxvf magento-1.7.0.0.tar.gz
tar -zxvf magento-sample-data-1.2.0.tar.gz
mv magento-sample-data-1.2.0/media/* magento/media/
mv magento-sample-data-1.2.0/magento_sample_data_for_1.2.0.sql magento/data.sql
mv magento/* magento/.htaccess .
chmod -R o+w media
mysql -u dbUserName -pdbPass dbName < data.sql
chmod o+w var var/.htaccess app/etc
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -rf magento/ magento-sample-data-1.2.0/
rm -rf magento-1.7.0.0.tar.gz magento-sample-data-1.2.0.tar.gz data.sql
And when I tried to browse the URL for Magento installation, I got the screen with ‘500 Internal Server Error’.
Being aware of all possible causes of 500 Internal Server Error during Magento Installation, I tried all possible solutions that i know like:
- Checking of Web / Unsecure / Base Url & Web / Secure / Base Urls
- Changing permission setting for index.php:
chmod 0755 index.php
- Changing permission setting for folder / files recursively:
find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \;
- Renaming .htaccess file:
mv .htaccess .htaccess.bak
etc…
But none of them worked for me.
When I checked at the apache error log file then I got the following error in the log file:
SoftException in Application.cpp:431: Mismatch between target GID (508) and GID (1072) of file “/home/username/public_html/index.php”
Note:
- 1072 -> id of ‘root’ user
- 508 -> id of ‘username’ user
From above it’s clear that error is due to mismatching between ownership and got solved by using the following command:
chown -R {username}:{username} /home/{username}/public_html
Where {username} = username of hosting provider(ex: hostagator.com)
Final Note:
Always make a habit of checking the Apache error log file in case of ‘500 Internal Server Error’ as the error can be caused due to various reasons instead of directly diving into solutions.