0

I ran this setup file after pulling down this repo. Now my MAMP server isn't working correctly. I think this file made changes to the Apache server config or something. Does anyone know what this file does, and how to undo it?

#Add the entry to /etc/hosts
#http://stackoverflow.com/questions/11287861/how-to-check-if-a-file-contains-a-specific-string-using-bash
HOST_ENTRY="127.0.0.1 $sitename.dev"
if grep -q "$HOST_ENTRY" "/etc/hosts"; then
   echo "Entry already exists in /etc/hosts"
else
  #https://blogs.oracle.com/joshis/entry/sudo_echo_does_not_work
  sudo sh -c "echo $HOST_ENTRY >> /etc/hosts"
  echo "Added entry to /etc/hosts file"
fi

#http://stackoverflow.com/questions/598190/mysql-check-if-the-user-exists-and-drop-it
#DBD=${dbuser}\\_%
#USAGE="*.*"
#sql="CREATE DATABASE IF NOT EXISTS $dbname;"
#sql+="GRANT USAGE ON *.* TO ${dbuser}@localhost;"
#sql+="DROP USER '${dbuser}'@'localhost';"
#sql+="CREATE USER '${dbuser}'@'localhost' IDENTIFIED BY '${dbpass}';"
#sql+="GRANT ALL PRIVILEGES ON \`$DBD\`.* TO ${dbuser}@localhost;"
#out=$(mysql -hlocalhost -uroot -e "${sql}")

# restart apache
sudo apachectl graceful

cd $DATA_DIR/../
mkdir cache
#./symfony project:permissions


npm install

bower install

composer install

gulp

open http://$sitename.dev

I've tried restarting my computer, changing directories in MAMP starting point, and tried different ports, but it's still not going where I want it to.

Mykola Gurov
  • 8,517
  • 4
  • 29
  • 27
TheCodeFox
  • 96
  • 10
  • Well, it does add a host entry to `/etc/hosts`, restarts apache, goes to the parent directory of your data directory, makes a new directory called `cache` and then installs npm, bower and composer. Not sure what gulp does... and then opens the website `$sitename.dev`. – Charlotte Dunois Jan 29 '16 at 18:55
  • Any idea why that might cause problems with other projects in MAMP? I changed the starting directory to another project of mine and it's saying it can't find those files on this server. – TheCodeFox Jan 29 '16 at 19:00

1 Answers1

0

This code started a second instance of Apache. So when my MAMP was set up to look for local host, it was actually using the virtual host and not my 'real' local host. I fixed it by manually running the command to stop the Apache server. Then I was able to reconnect with MAMP and tell it to use the correct localhost.

TheCodeFox
  • 96
  • 10