Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MAMP/MAMP PRO #1

Open
pirog opened this issue Oct 14, 2013 · 1 comment
Open

Add support for MAMP/MAMP PRO #1

pirog opened this issue Oct 14, 2013 · 1 comment

Comments

@pirog
Copy link
Contributor

pirog commented Oct 14, 2013

Would be great to provide terminatur.mamp.inc to get this to work on MAMP/MAMP PRO. Looks like checking to see if the user is running MAMP and adding vhosts to OSX Apache is easy enough:
http://foundationphp.com/tutorials/vhosts_mamp.php

Can use https://github.com/kalamuna/terminatur/blob/master/environment/terminatur.default.inc as a template. Just need to replace default with mamp and edit the constants appropriately. Can probably copy the etc/hosts and server restart commands from kalastack.inc and model after the vhost ones but adapted for the above link.

Then want to provide some sort of identification function into _terminatur_get_environment() in terminatur.drush.inc presumably just checking whether the app exists or not?

@andrewmallis might want to give it a shot?

@andrewmallis
Copy link
Member

Challenges

MAMP vs MAMP PRO vhosts

I'm not sure how to detect if MAMP or MAMP PRO is in operation on the user's system.
This is impactful, because while both versions point to the same binaries, each has their own config files for Apache, and this will determine how the vhosts get created.
We should just hammer both with our own include in httpd.conf and write to that:

Include /path/to/our/httpd-termintur.conf

We can likely use this same file outside of MAMP too.

ports

The user can configure quite a bit in the App, such as the user/group running services (myuser/mygroup or www/mysql) and the ports they run on (Apache/MySQL/SSL: 8888/8889/8890, 80/3306/443, or custom with PRO only)

default webroot

Default MAMP webroot is
/Applications/MAMP/htdocs
but there is no default for MAMP PRO, the user can navigate the file system
we may need to parse the httpd.conf file

Apache

It's not trivial to get either flavor of mamp to restart via the command line. This should, but does not work:

/Applications/MAMP/bin/apache2/bin/apachectl restart

I've tried over the years to get command-line control of apache to work, but it never really took. MySQL is no problem; it's just Apache that's problematic. We could prompt the user to restart MAMP services via the control panel once the vhost is created.

MAMP stores its config in a writeable file at
/Applications/MAMP/conf/apache/httpd.conf
but MAMP PRO uses templates

MySQL


/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

will let you connect to MySQL, but if the user has changed the root password (this is encouraged by the UI), we'll want to make the prompt clear

PHP & Drush support in MAMP

While we want to assume that the user has their Drush set up under MAMP, this can prove tricky.
These are paths to the multiple PHP binaries. MAMP can switch between these through the UI. There are different versions of PHP depending on the version of MAMP.

/Applications/MAMP/bin/php/php5.2.17/bin
/Applications/MAMP/bin/php/php5.3.14/bin
/Applications/MAMP/bin/php/php5.4.4/bin

Drush, and by extension Terminus and Termintur will want to find the webserver's PHP binary. The command line won't connect there for the user unless declared in their $PATH.

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants