Adding SSH2 to MAMP and MAMP PRO on Yosemite the easy way

 

You will require autoconf.

http://mac-dev-env.patrickbougie.com/autoconf/

Install via the above instructions will work. Also, using Homebrew will work.

Cannot find autoconf. Please check your autoconf installation and the

$PHP_AUTOCONF environment variable. Then, rerun this script.

Download the php version that matches the one you will be using with MAMP Pro.

Copy the extracted files to MAMP php folder in /Applications/MAMP/bin/php/php5.5.18/include/php

Do not copy the subfolder created by the extraction, only copy the contents of that folder. You may have to create the ‘include/php/‘ folders as they might not already exist.

Also, do change the PHP version number to match the one you’re using.

./configure --without-iconv

Adding SSH2 extension to your MAMP the sure way

  1. Download libssh2 from source forge, direct link here
  2. Then extract the package, configure, compile and install it.
    user:compile$ tar -xf libssh2-1.2.1.tar
    user:compile$ cd libssh2-1.2.1
    user:libssh2-1.2.1$ ./configure
    user:libssh2-1.2.1$ make
    user:libssh2-1.2.1$ sudo make install
    Password:
    
  3. Download SSH2 PECL source code, get the latest stable version.
  4. Then untar and compile it.
    user:compile$ tar -xf ssh2-0.12.0.tar
    user:compile$ cd ssh2-0.12.0
    user:ssh2-0.12.0$ phpize
    If you don’t have have autoconf installed this is where you will get an error. Cannot find autoconf. Otherwise, proceed.
    user:ssh2-0.11.0$ ./configure
     
    If you get this error

    /Applications/MAMP/bin/php/php5.5.18/include/php/Zend/zend.h:51:11: fatal error: ‘zend_config.h’

          file not found


     
    This is probably because you did not compile the PHP you downloaded.
     
    user:ssh2-0.11.0$ make
    
     
  5. Look in
    ssh2-0.12.0/modules/ to find ssh2.so
    Copy this file to your MAMP location.
  6. Chmod 755 the location of your ssh2.so file.
  7. Edit templates in MAMP Pro, File->Edit Template->PHP-> Choose the PHP version you have compiled with.
  8. Add the line , in the [extensions] section
    1. extension=ssh2.so
  9. Save changes
  10. Restart MAMP Pro
  11. Check phpinfo()
  12. Try it out

2015 03 01 11 47 08 PM 

If you are using Linux, such as Debian, Ubuntu you can install XAMPP for Linux. Compile ssh2 using the same instructions, update the php.ini file the same way. 

 

 

Creds: http://stackoverflow.com/questions/10717752/having-problems-while-try-to-install-oauth-with-pecl-in-mamp-on-mac-os-lion

http://stackoverflow.com/questions/24987305/php-configure-error-please-specify-the-install-prefix-of-iconv-with-with-icon

Add ssh2.so to MAMP pro from source

A tell tale sign that ssh2 is missing is that exception is thrown on the line using this function.

ssh2_connect( ) ;

 

 

Adding SSH2 extension to your MAMP the hard(er) way

Well, if my binary above doesn’t work for you, then you may have to compile SSH2 extension yourself. Please look over my other article Rebuilding MAMP stack from scratch. to make sure you have all the prerequisites. Assuming that you do,

  1. Download libssh2 from sourceforge.
  2. Then untar the file and compile it.
    user:compile$ tar -xf libssh2-1.2.1.tar
    user:compile$ cd libssh2-1.2.1
    user:libssh2-1.2.1$ ./configure
    user:libssh2-1.2.1$ make
    user:libssh2-1.2.1$ sudo make install
    Password:
    
  3. Download SSH2 PECL source code.
  4. Then untar and compile it.
    user:compile$ tar -xf ssh2-0.11.0.tar
    user:compile$ cd ssh2-0.11.0
    user:ssh2-0.11.0$ phpize
    user:ssh2-0.11.0$ ./configure
    user:ssh2-0.11.0$ make
    
  5. Once you successfully compile, you should have ssh2.so under modules/ directory. At this point, you can simply copy the file to the appropriate location of your PHP (or you can follow the same instructions above for either MAMP or the built-in PHP).

That’s about it … I hope that this article helps you in enabling ssh2 extension for PHP on your MacOS X. And as always, I welcome comments / suggestions / questions. I’m looking forward to improving my solution with your comments / suggestions / questions.

Install SSH2 with MAMP Pro 5.5.10+

I ran into the issue with php.h missing.

 

The path for this system is set with

 

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad

export MAMP_PHP=/Applications/MAMP/bin/php/php5.5.10/bin
export PATH=”$MAMP_PHP:$PATH”

 

This ensures PHP from MAMP Pro is being used not the OSX version. 

 When trying to compile SSH2 php.h is missing which causes fatal error…. 

 Follow these steps, and retry SSH2 compilation as per these steps.

  

Here’s how I fixed it:

  1. MAMP doesn’t provide the source code archive for PHP 5.4.10 so download it from php.net
  2. Extract the source code archive to /Applications/MAMP/bin/php/php5.4.10/include/php
  3. Run ./configure to configure the source code for your platform (without this step the pecl install will fail looking for a bunch of header files)
  4. Retry compilation for ssh2

 

If you run phpinfo() you should now get an entry for ssh2 as follows:

ssh2

SSH2 support enabled
extension version 0.12
libssh2 version 1.4.3
banner SSH-2.0-libssh2_1.4.3 

 

Additional reading:

https://stackoverflow.com/questions/10717752/having-problems-while-try-to-install-oauth-with-pecl-in-mamp-on-mac-os-lion/11175197#11175197

Enable xDebug MAMP Pro Mac OSX PHPStorm

WARNING: Do not edit the php.ini files manually. If you try to edit your files with Finder your changes to php.ini will not be applied.

First, are you using MAMP (free) or MAMP Pro

Turns out there is a difference between the php.ini file you edit from MAMP and the php.ini file that PhpStorm uses in the interpreter.

The MAMP Pro php.ini file resides in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini and doesn’t have a PHP installation (which PhpStorm needs when setting the interpreter). If you run phpinfo(); this is the file you will see data from.

When you set PhpStorm to the necessary location here /Applications/MAMP/bin/php/php5.4.x/bin it looks at the php.ini file there, not the one that MAMP Pro uses (above). So if you want PhpStorm to see the debugger, you need to add the code to that php.ini file.

 

STEPS:

With MAMP Pro open, go to  File-> Edit Template -> PHP -> Choose the appropriate PHP Version

Now, locate the extensions section of the php.ini file

Add the following line:

zend_extension=xdebug.so

When you’re done, your extensions section should look like something like this (bolded line for emphasis).

; Extensions

MAMP_apc_MAMP

extension=imap.so

extension=gettext.so

extension=mcrypt.so

extension=yaz.so

extension=pgsql.so

extension=pdo_pgsql.so

extension=pdo_mysql.so

extension=imagick.so

extension=tidy.so
zend_extension=xdebug.so

Close the php.ini Edit Template window. MAMP Pro will prompt to restart server, choose Yes.

 

Important to use the ‘zend_extension’ prefix.

Before sure to make the same changes in php.ini located in the Applications/ folder (substitute the php version number for the version you are using).

/Applications/MAMP/bin/php/php5.5.10/conf/php.ini

 

This configuration will work with PHPStorm.

Restart PHPStorm. Restart your browser.

 Try xDebug it will work.

zend_extension

Install SSH2 on OSX MAMP PRO

 

Creds http://cyberpunx.com/2011/11/install-ssh2-support-for-mamp-and-php-5-3-x/

Updated instructions 2014

brew update

brew doctor

brew install libssh2
cd /Applications/MAMP/bin/php/php5.4.25/
sudo php -d detect_unicode=0 /usr/lib/php/install-pear-nozlib.phar
sudo pear upgrade
sudo pecl install channel://pecl.php.net/ssh2-0.12

When prompted for the libssh2 prefix, just press enter for autodection:

libssh2 prefix? [autodetect] :
 

Build process completed successfully

Installing ‘/usr/lib/php/extensions/no-debug-non-zts-20100525/ssh2.so’

install ok: channel://pecl.php.net/ssh2-0.12

configuration option “php_ini” is not set to php.ini location

You should add “extension=ssh2.so” to php.ini

 

cp /usr/lib/php/extensions/no-debug-non-zts-20100525/ssh2.so /Applications/MAMP/bin/php/php5.4.25/lib/php/extensions/no-debug-non-zts-20100525/ssh2.so

chmod 755 /Applications/MAMP/bin/php/php5.4.25/lib/php/extensions/no-debug-non-zts-20100525/ssh2.so


Edit template, add extension=ssh2.so

restart apache, check for ssh2 with phpinfo mama start page

which php should give you the version of php on osx, if the one you’re using with mamp is not far apart then this method will work, otherwise you will have to compile with php version that matches the one you’re using in mamp

 

How to install ssh2.so for PHP 5.3.x on OSX Lion and MAMP

 

For a recent project I needed to use the ssh2 extension with PHP. I had tried to use phpseclib, but found that it doesn’t support for DSA keys (a requirement for my project). Using the instructions below, you can easily install ssh2 support for PHP using homebrew.

Using homebrew to install libssh2:

brew install libssh2

I was working with a fresh OSX Lion install, so I needed to install pear. Luckily it comes with Lion, so we just need to install and update.

sudo php -d detect_unicode=0 /usr/lib/php/install-pear-nozlib.phar
sudo pear upgrade

After pear is setup, we can use pecl to install the ssh2 extension:

sudo pecl install channel://pecl.php.net/ssh2-0.11.3

When prompted for the libssh2 prefix, just press enter for autodection:

libssh2 prefix? [autodetect] :

This next step is optional and should not be done if you already have a /private/etc/php.ini file. However, this step may help others who are working with a fresh install like I was:

sudo cp /private/etc/php.ini.default /private/etc/php.ini

Now we need to add the ssh2.so to the php.ini …so open /private/etc/php.ini with your favorite editor and add the following line:

extension=ssh2.so

After saving, run the following command and it should output ‘ssh2′:

php -m | grep ssh2

Now lets copy ssh2.so to the MAMP extension folder:

cp /usr/lib/php/extensions/no-debug-non-zts-20090626/ssh2.so /Applications/MAMP//bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/

Edit the php.ini template for MAMP’s PHP install and add:

extension=ssh2.so

MAMP PHP Template

Restart MAMP… ssh2 extension should now be installed for the system’s PHP and MAMP’s PHP.

Output of phpinfo(); will show this:

 

Where are mysql db files kept – MAMP PRO and more

Where are MySQL’s Files Kept?

MySQL stores and accesses files in various places on your hard drive. This page documents the locations of commonly used files, for some often used MySQL installations.

If you want to backup your data or copy data from one server to another, please don’t copy the data files directly. It is recommended to use Sequel Pro’s Export and Import features (use a MySQL dump) to accomplish this.

If you can’t find the files in the locations given here, it could be because you changed the configuration — these are only the default locations. Some of the files only exist while the MySQL server is running (eg. the socket file).

If your installation has no option file (my.cnf), you can create it in the base directory of your installation (see ‘Using Option Files’ section of the MySQL manual for more information).

If you can connect to your MySQL server, you can find many of these paths by selecting Show Server Variables… from the Database Menu in Sequel Pro.

MySQL installed with the official .pkg installer

Socket File
/tmp/mysql.sock
Data Files
/usr/local/mysql/data/
Error Log
/usr/local/mysql/data/HOSTNAME.err (insert your hostname)
Base Directory
/usr/local/mysql/ (this is a symbolic link)

MySQL pre-installed on Mac OS X Server

Socket File
/var/mysql/mysql.sock

MySQL 5 installed with MacPorts

Socket File
/opt/local/var/run/mysql5/mysqld.sock
Data Files
/opt/local/var/db/mysql5/
Error Log
/opt/local/var/db/mysql5/HOSTNAME.err (insert your hostname)

MySQL installed with MAMP

Socket File
/Applications/MAMP/tmp/mysql/mysql.sock
Data Files
/Applications/MAMP/db/mysql/
Base Directory
/Applications/MAMP/Library/
Error Log
/Applications/MAMP/logs/mysql_error_log

MySQL installed with MAMP PRO

MAMP PRO shares many paths with MAMP, with the following difference:

Data Files
/Library/Application Support/appsolute/MAMP PRO/db/mysql

MySQL installed with XAMPP

Socket File
/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
Data Files
/Applications/XAMPP/xamppfiles/var/mysql
Configuration File
/Applications/XAMPP/xamppfiles/etc/my.cnf

 

MySQL installed with Zend Server CE

Socket File  
/usr/local/zend/mysql/tmp/mysql.sock
http://www.sequelpro.com/docs/Where_are_MySQLs_Files