I was able to solve the problem through terminal. I figured out the PID of the processes that were using the port and then used:
sudo kill -9 PID
once I killed those off, MAMP and moodle and running well.
sudo kill -9 PID
once I killed those off, MAMP and moodle and running well.