Jump to content

How to use MAMP Pro on Mac to copy forum?


Millipede

Recommended Posts

I’ve never used a local server app before and thought I’d try it. I installed MAMP Pro 5 yesterday on my Mac as I have other sites I’d also like to use it with.

I can’t figure out how to use it... I’ve looked at MAMP’s documentation, but it seems mostly aimed at creating new sites and using it with Wordpress, and I don’t find it that explanatory.

Could some kind person please tell me, step-by-baby-step, in idiot-proof language, how to import an existing forum (with its database, obviously) into MAMP Pro?

And what parts of the conf_global.php file to edit? Mine’s very long, and has what looks like relics from old IPB versions as it makes reference to IPB 1.3 and shows offline text from 2008 (I used to date my messages). All I know is that the password and username is “root” for all sites.

Can I choose a folder anywhere as the “Document root” to keep my sites in? Or must it really only be in the Applications folder?

And why does it ask for keychain access?

Thanks in advance!

Link to comment
Share on other sites

Perfect for WP; a nightmare with IPS / IPB even though the thought of having a GUI seemed attractive. Also tried XAMPP for Windows + XAMPP VM for MacOS + MacOS server app. Just as bad. Easiest / idiot proof way is to use homebrew. And written an extensive guide for it, which is on our crew only forum. Hmz, lets see if I can copy/paste it. brb ?

 

HomeBrew: The missing package manager for MacOS X

Let's get straight into the meat & potatoes with copy/paste cmds in a MacOS terminal. As it takes less than 10 minutes to setup!

Install HomeBrew

First

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

second install tap brew services

brew tap homebrew/services

This will give you the services cmd you might be familiar with from Linux to start, stop and restart webservices.

Install Webserver package

We are (still) running Apache2 / LAMP stack. So ..

brew install apache2

DocumentRoot is /usr/local/var/www. The default ports have been set in /usr/local/etc/httpd/httpd.conf to 8080 and in

/usr/local/etc/httpd/extra/httpd-ssl.conf to 8443 so that httpd can run without sudo.

 Optional Nginx / LEMP

Prefer to mess around with nginx (LEMP stack) + Redis later? Which is the recommended platform by invision?

brew install nginx
brew install redis

notes:

  • for simplicity sake ? Apache2 is the easier way most people know about. The syntax for getting sh*t done in nginx is quite complex (no .htaccess support for example).
  • Nginx is running on port 8080 by default too, something you might want to change at /usr/local/etc/nginx/nginx.conf
  • in both cases the DocumentRoot is /usr/local/var/www

Install MySQL package

brew install mariadb

 

Install PHP

brew install php70

When it's done? You can ignore the output if installation was successful. And let's install a few more, so you have them all while at it! Although we used PHP 7.0

  Hide contents
brew install php56
brew install php71
brew install php72

For configuration just go to /usr/local/etc/php/  and/or watch cmd line for specific howto steps.

Let's first test if it the server works, shall we? 

First Run

brew services start php70
brew services start mariadb
brew services start httpd

Visit http://localhost:8080 and you should see: "It works!"

Done? Nope. As we are working towards IPS4 installation.

Enabling & Fine-tuning PHP

Set / double check PHP version in Apache2 webserver

Edit /usr/local/etc/httpd/httpd.conf and add to the bottom of the file:

LoadModule php7_module /usr/local/opt/php@7.0/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
	SetHandler application/x-httpd-php
</FilesMatch>

Plus add index.php as alternative index file -- next to index.html -- at line nr 281:

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
     DirectoryIndex index.html index.php
</IfModule>

You can change the post it listens to on line nr 52. Default is 8080. Changing it to 80, requires sudo access. Not a big deal, just something to be aware about. I like to keep at the default port.

Edit PHP settings

Edit: /usr/local/etc/php/7.0/php.ini and search and change the values of / into:

max_execution_time = 300
max_input_vars = 7500
memory_limit = 256M
post_max_size = 500M
upload_max_filesize = 500M

which are just a few best practices for any kind of local server environment in PHP.

(HOWTO) restart server stack

brew services restart php70
brew services restart mysql
brew services restart httpd

note: strictly speaking you don't have to restart all 3, that's just one of my habbits as I put in a script in my OSX homedir. Mine is optimized for IPS4. Depending on which other services you installed you can also just execute: 

brew services restart --all

extra tip: to see a list of services execute:

brew services list

So lets get down to the final setup bit ..

Additional Tools / tips

PHPmyAdmin alternative

Single file with full compatibility and loads of other benefits: https://www.adminer.org/en/phpmyadmin/ ... also better than bigdump (gave errors in sql syntax).

brew install wget
wget "https://www.adminer.org/latest.php" -O /usr/local/var/www/adminer.php

Visit: http://localhost:8080/adminer.php and you should see a familiar screen. Login with default user "root" and no password. Or simply use (after having setup a "test"  db) :

mysql -uroot test < blabla.sql

Restore webserver files

cd /usr/local/var/www
mkdir IPS4-bla
cd IPS4-bla

and put your invision file content there. Megatip: forget filezilla or any other FTP client and purchase https://crossFTP.com .. even when transfering a single file the upload/download speeds are ultra faster.

Access Rights / chmod

Open terminal, and assuming you are running IPS4 from and execute:

cd /usr/local/var/www/
sudo chmod -R 777 *

For simplicity sake obviously ? 

Tip: getting a chmod error? Order of parameters is different from Linux AND cmd needs sudo rights.

IPS tips & tricks: post install (useful for MAMP Pro too)

File structure

The reason most tarball site dumps are are multiple GBs in size when it comes to files and folders is due to the /uploads/ folder. Most space  is occupied by the entire monthly* folder range -- which stores all the attachments -- and /uploads/profiles/ which stores all the profile pics of users. The other folders contains emoticons, and other useful things you might want to have in your dev environment. Which are ± 90MB.

Conf_global.php

To run IPS4 locally (instead of the web) you need to make a couple of changes to /conf_global.php

  • Do NOT use 127.0.0.1 but "localhost" for 'sql_host' (a generic best practise + advised by invision)
  • 'sql_database'
  • Default  'sql_user is "root" and no password
  • Correct  webserver path configuration: 'board_url' parameter

License (optional)

By now you should be able to login. Go to ACP -> settings -> License key ... "change licensekey" button. And append "-TESTINSTALL" to the license key, as explained here: https://invisioncommunity.com/4guides/welcome/install-and-upgrade-r259/

Note: not very necessary (or hasn't been for the past couple of years) but just to play nice with invision as we can have unlimited installs then. ;-)

Change file storage dirs

In the ACP backend: gear icons -> Files (under overview), configurations tab. And change path to:

/usr/local/var/www/IPS4-bla/uploads

Change Sitemap Link

In the ACP backend: Gear Icons -> Search Engine Optimization (under "Site Promotion"). 2nd tab "Sitemap". Change path to:

http://localhost:8080/sitemap.php

And that's it! You now should be able to have access to your own local running IPS4 dev environment! Running into any final errors? Then download and install this free  https://invisioncommunity.com/files/file/8076-clear-cache/ plugin. And run it from the top header in your ACP backend. Invision support clear cache thing doesn't work very well.

To Recap

You now got (bookmark worthy ) :

--------

and that's pretty much it. We used this a lot with our co-admins located in countries not blessed with high speed internet connections. Passing around 7zipped database (40% better compression then the usual solution through 'keka' app). When you do favor something with a GUI? XAMPP on a Windows box was easiest. To do it with Parallels Desktop or any other virtualization solution? Possible too. And do love MAMP Pro. Homebrew just made it easier when you're familiar with terminal / ssh based server management and running a lot of custom solutions. No shoe fits all ?

Link to comment
Share on other sites

These are the steps that I know, maybe they are still the same ?

1. Once you have your DB, use Bigdump to import.
2. Put your sql and bigdump.php file inside your folder (ipb installation)
3. Open bigdump.php with your text editor, configure line 39 with your data.
    Find line 93 and change max query_ines to 1000
4. Edit your config.php.
Should be something like this:

$INFO = array (
  'sql_host' => 'localhost',
  'sql_database' => 'YOUR_DB_NAME',
  'sql_user' => 'YOUR_DB_USER_NAME',
  'sql_pass' => 'YOU_DB_PASS',
  'sql_port' => 3306,
  'sql_socket' => '/var/run/mysqld/mysqld.sock',
  'sql_tbl_prefix' => 'prefix',
  'sql_utf8mb4' => true,
  'board_start' => 000,
  'installed' => true,
  'base_url' => 'http://localhost:8888/YOUR_INSTALLATION_FOLDER/',
  'guest_group' => 2,
  'member_group' => 3,
  'admin_group' => 4,
);

5. Run bigdump.php through your browser.

I think that's all ?

Link to comment
Share on other sites

Thanks for the replies :smile:

Wow, what a great post, @rhyker2u ! Whilst I’m not a computer newbie, all that Homebrew stuff feels like double-Greek to me, I’m afraid; and I’m not terribly comfortable with Terminal...

So I’m afraid I’m still no wiser as to how to even begin (without Homebrew)...

I seriously don’t understand how MAMP Pro can be touted in reviews as being “easy to use”! How can it be “easy to use” if it’s such a rigmarole to even begin?

What I’d like to know is:

- Where exactly do I put the files/folders I’ve downloaded via FTP? I’d rather not have them in the Applications folders.

- How do I import the database and into where? (maybe using BigDump.php if necessary)

- Apart from changing DB password and username to “root” in conf_global.php, what else, if anything, do I need to change?

There really should be proper documentation somewhere for complete beginners in MAMP Pro, and not one that sends you round in circles by clicking on links in a page that take you to other pages that are several pages ahead (or behind), which in turn makes you lose track of the order in which to do things.

If it’s going to be such a complicated palaver to use, then I’ll simply give up on the idea. Or does everybody go through a song and dance to get their sites into it?

 

Link to comment
Share on other sites

Files... /Applications/MAMP/htdocs I understand you may not like that location, But if you're not comfortable with setting up a site in the default configuration you likely won't be comfortable reconfiguring MAMP itself. You may be able to get away with a symlink, but I would stress to simply get it working out of the box first. 

DB... Import using phpmyadmin, comes with MAMP, or use terminal mysqldump. There are plenty of Google results on how to use that. 

Then update your conf_global.php.

Link to comment
Share on other sites

I'm trying to trace back in my thoughts what made me decide to use homebrew, cause as mentioned did like MAMP pro a lot. As it's sweetspot between XAMPP and MacOS Server App. Think it was due I started with MAMP free version which had limited control over PHP and Mysql/MariaDB versions, and one point during site migration was running 20+ test environments and clicking around all the GUIs made me go crazy, and was using a lot of custom perl / python / awk terminal magic already to make certain changes a lot faster. But as that's far behind me now? Moving to MAMP Pro again for invision community makes sense.

Anyway, based on my own requirements and as you brought it up. I will make a full blown MAMP Pro tutorial with screenshots, including step-by-step post install on finetuning. As I have to reinstall it anyway ? ETA? After the weekend probably.

Cannot wait? ? PhpMyadmin / bigdump (https://www.ozerov.de/bigdump/) / mysql cmdline ... have their perks in all kinds of scenario's. The reason many people recommend PhpMyAdmin and why it comes preinstalled by default, is that's been around for a long time. Easy? No; most of us just got used to browsing around its dysfunctional UI. Combine the benefits without the drawbacks of all 3, and you get adminer. Download

https://www.adminer.org/latest.php

... move to your webfolder (any). Rename to adminer.php ...  fire it up through your browser and gives the best intuitive experience without needing to google. Then apply @Heosforo conf_global.php suggestion and my ACP post-install finetuning suggestion (somewhere at the bottom of my earlier shared guide). Further clarification:

  • although both phpmyadmin and adminer still means you should edit php.ini when importing large DBs.
  • MySQL cmd line doesn't have that issue; neither does bigdump (in theory). But involves command line again
  • Bigdump is an unmaintained script that sometimes throws strange errors during processing particular MySQL/MariaDB dumps; which results in having a partial DB import that needs be dropped / cleared before trying again. Can be done using mysql / phpmyadmin / adminer.
  • But editing php.ini to tweak a couple of settings for a local test environment is smart anyway, because the default values might give timeout issues when uploading invision themes / plugin / pages content through ACP later on.

That's why any local server (GUI or not) ain't always easy. Out-of-the-box it's not custom tailored towards invision. Like https://local.getwhyfeel.com is for WordPress.  Even more so because invision self-hosted installs are modular. Not everybody might have the ecommerce / blog module. Which makes creating 1-click install solutions like through XAMMP VM / VMware Player images quite difficult. No pain, no gain. ?

@Millipede what server stack you use? LAMP (Apache2) or LEMP (NGINX) ? My best guess is the second, with PHP 7.2 I suppose? So I can keep it super simple instead of needing to cover other avenues hehe.

However, the easiest way to setup a 'test environment '?  Is plain simply clone your current live site from your webhosting panel (cpanel for example). As invision's license permits two online installs with 1 license key (1x live + 1x test). Saves you from the entire local config issue, but also means you can utilize invision support with or without an optional pro support contract. By simply edit the "stored access information" with the ACP admin and FTP credentials of the online test environment after you click on your site license in https://invisioncommunity.com/clientarea/purchases/

Link to comment
Share on other sites

Thanks again, rhyker2u, your helpful efforts are appreciated even if I’m not sure I understand all that you write about :smile:

I’m sorry, I don’t know what a server “stack” is...

I’m on cPanel with Apache and MySQL.

I already have a “live” test site for my forum. I was hoping to use MAMP not just for my IPB forum but also for a couple of Joomla sites and to keep copies of older versions of these for reference.

The forum and the Joomla sites are currently using PHP 5.6.

In MAMP Pro’s online documentation, this is what’s confusing to me, as it sounds contradictory:

On the one hand, they say:

Quote

Note: Although the default localhost document root is located in `/Applications/MAMP/htdocs`, it is best to keep it's [sic] document root, and the document root of additional hosts out of the `/Applications/MAMP folder`. A better directory structure for your host document root folders would be `~/sites/localhost`, `~/sites/site1`, `~/sites/site2`, etc ... .

Then they seemingly contradict themselves by saying:

Quote

Will MAMP work if the MAMP folder is not located in the Applications directory?
No. In order to work properly the MAMP folder has to be located in the Applications folder.

And they also say:

Quote

MAMP PRO is not allowing me to set sub-directories of my home(~) directory as a document root?
In most cases, changing your server launch users to “Unix Users” will make your permissions less restrictive and allow you to use a wider range of directories as your document root. To change your server launch users go to your Settings > Ports tab and change the “Run Servers As:” option to “User”.

?????????

Link to comment
Share on other sites

That's where symlinks likely come into play. Store your site in your user directory and symlink to the /Applications/MAMP/htdocs/site directory. 

Though the user permissions won't be an issue if you run MAMP as the root user. Requires you to enter the root password when starting the server.

@rhyker2u My mantra, when I don't understand something fully, is KISS... Keep it simple. Adminer may be a great tool, but it doesn't come with MAMP out of the box. There are infinite ways to solve a problem, and infinite opinions, but what's the absolute easiest? If you're driving a pinto, 0-100 mph time means nothing, you'll never get there. But if you start small, eventually upgrade to a Porsche as you learn, then 0-100 time matters. 

Don't get the impression in discounting anything you're saying. It's just @Millipede has made it quite clear that he/she doesn't understand how the tool they are interested in works. If he/she can't understand the basic tool and the steps to deploy files and a DB with that tool, how are they expected to understand the installation of yet another tool and configuring the 2nd  tool that's also unknown to them? 

A guide would be awesome, and likely something I'd nominate for the IPS picks, but you should make it such that it includes the basic steps of using it out of the box... Then add additional sections for other cool tools you can add to it, and how those tools provide a benefit.

Link to comment
Share on other sites

 

Hence making a tutorial. Was going to sooner or later anyway (and create a separate topic about it); its just how it came up at the moment ? And going over other options based on your folks feedback and get some clarity, so others don't have to 2nd guess or spend time at it why/how something works when they run into it. As we already got full-blown picture walkthrough on our crew-only forum, but then only 2-3 people benefit. Love to give back to the community and providing pro-active solutions to unknown problems, cause invision support? Wasn't able to assist us with most things; forwards to forum -- on things that really should be in https://www.invisioncommunity.com/4guides (although respect that invision doesn't have infinite time either in dealing with niche thingies) -- and if I can help anyone save a couple of weeks by getting clear on what they really need? By sharing best practices; then I will. But yes you're right. Got carried away a bit; upzy. Hence also offering the suggestion to not setup a local testconfig at all, and just clone a live install + get a pro support contract. Something we had to figure out on our own as well. Anyway no such a things as the perfection solution ?Learning new stuff all the time too.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...