Antk, there are well documented & somewhat odd interactions between MySQL and PHP on unix operating systems where both sockets and TCP connections are possible via localhost (detailed discussion here) and very specific quirky behaviors of the PHP PDO Library relating to how MySQL client connections that are initiated via the sockets implementation (detailed discussion here)....
BUT
tl;dr : Don't waste your time figuring out how to resolve the idiosyncracies between your local OS version, an older version of Magento, and the specific release of the MySQL client / server in your MAMP stack. It's easier to just ditch MAMP and grab a VM and use it to develop locally, plus it's more like the production environment you're going to run your code in when you deploy it.
OPTION 1 > Ditch MAMP for a VM Dev Environment
Here are the quickest ways to ditch MAMP and go with VM development for your version of Magento :
FAST & SIMPLE: Grabbing a BitNami pre-built Magento 1.7.0.2 stack ready to run on boot on an Ubuntu VM (you will need virtualbox (free) or some other virtualization system like Parallels or VMWare Fusion). Although this is the fast route, there are some quirks with how BitNami lays out the filesystem and configures apache & php that will likely differ from your production environment, but it will work when you start it up because it's completely self-contained.
SLOWER but CONTROLLED : Installing vagrant and virtualbox using a VM for your local development via one of the many scripts that will provision vagrant & set up Magento for you in your VM. This gives you the most flexibility to configure it the way you need, but requires that you do the configuration after the basic provisioning is done via vagrant and may take more time to complete.
I'm also not sure if phpMyAdmin is included in that vagrant file, but is IS included in the BitNami image if you prefer using it vs connecting to the Server via a MySQL Workbench or another SQL Editor.
If you're feeling like an adventure (or inflicting some self torture), these two options walk you through the best route to troubleshoot your specific error and get to the bottom of what's happening with your MAMP install:
-
OPTION 2 > Modify your php.ini file
As the first link states, you can force the PDO library to use sockets if you know what the name of the socket is:
(either by looking in the php.ini file or by using: phpmyadmin or the console (or construct it in mysql or mysqli)...to run the following query (anything but PDO):
show variables like 'socket'; //as mentioned by symcbean
THEN, in the PDO connection string, change it to use the socket instead of a hostname:
> $dbc = new
> PDO("mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=$DBName",
> $User, $Password, array(PDO::ATTR_PERSISTENT => true)); // using
> persistent connections
OPTION 3 > Update to your app/etc/local.xml file.
Change localhost
to 127.0.0.1
or to the IP address of your Mac and the PDO library should be able to initiate a connection from the MySQL client => Server.
Updated config below:
<host><![CDATA[127.0.0.1]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[root]]></password>
<dbname><![CDATA[my_db_name]]></dbname>
or
<host><![CDATA[192.168.0.1]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[root]]></password>
<dbname><![CDATA[my_db_name]]></dbname>
These might work, but requires directly modifying the PDO driver in the core files, which goes against best the recommended best practices of Magento development OR implement an overrided driver that is only used on your local development instance (seems like a lot of work to get a dev environment working if you ask me...)
Best Answer
After lots of effort i solved the issue. It was an issue caused due to .htaccess
Now after making modifications in .htaccess of the root folder. I checked the subfolders where other two of my websites were kept.
1) First thing i did was delete the .htaccess file in that folders.
2) As my images were not loading, i went to the media folder there i found .htaccess file. The content of .htaccess file was as follows
I am not sure how it was giving
Internal Server Error
. But i deleted it from media folder of both subfolders as i though it wont be much of a risk. This started loading my images.As i am not an expert on .htaccess i am not sure what security threat it will cause on the website.
It would be great if anyone can advice me on this