-
Notifications
You must be signed in to change notification settings - Fork 45
VuFind 3 and Later with MAMPStack on Mac OS X
Before starting with MAMPStack, retrieve the VuFind code with git to a directory of your choice. Don't put it in the MAMPStack directory as that would make upgrading MAMPStack more difficult.
-
Download MAMPStack with PHP 7.x directly from Bitnami web site at http://bitnami.org/stack/mampstack. Don't install MAMPStack from App Store unless you're ready for a world of hurt.
Use default settings (you may unselect other components but keep PHPMyAdmin unless you want to always use mysql command line tool). Note that MAMPStack is installed in Applications and there is manager-osx application for controlling the services. By default Apache will listen in http://localhost:8080/.
Here it is assumed the installation directory is /Applications/mampstack, but adjust as necessary. You may also add /Application/mampstack as a symlink pointing to the actual installation like this:
ln -s /Applications/mampstack-7.x.yy-z /Applications/mampstack
-
Add the following line as the second line of /Applications/mampstack/apache2/scripts/ctl.sh (for PHP running under Apache) and /Applications/mampstack/use_mampstack (for PHP in terminal):
export PHP_INI_SCAN_DIR="/Applications/mampstack/php/etc/php.d"
-
Add the following line to the end of /Applications/mampstack/apache2/conf/httpd.conf:
IncludeOptional conf.d/*.conf
-
Create directory /Applications/mampstack/php/etc/php.d
-
Create directory /Applications/mampstack/apache2/conf.d
-
Add the following settings to /Applications/mampstack/php/etc/php.d/php.local.ini (customize as necessary):
memory_limit = 2048M error_reporting = E_ALL display_errors = On sendmail_path = "env -i /usr/sbin/sendmail -t -i" date.timezone = "Europe/Helsinki" error_log = /Users/[your id]/Library/Logs/php_errors.log [main function] sendmail_path = "env -i /usr/sbin/sendmail -t -i" [opcache] opcache.enable=0 [XDebug] zend_extension="/Applications/mampstack-5.6.15-0/php/lib/php/extensions/xdebug.so" xdebug.remote_enable=true xdebug.remote_autostart=true xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_handler=dbgp xdebug.show_exception_trace=0
Note that for PHP 7.1 you may need to use the following error_reporting setting until we get rid of mcrypt:
error_reporting = E_ALL & ~E_DEPRECATED
-
Copy local/httpd-vufind.conf.sample from VuFind directory to /Applications/mampstack/apache2/conf.d/httpd-vufind.conf
-
Modify the paths in httpd-vufind.conf to point to the VuFind installation directory.
-
Restart Apache e.g. using manager-osx
-
Copy .sample files to their proper names etc. in local/config/finna and local/config/vufind for the basic setup of VuFind and modify at least local/config/vufind/config.ini accordingly (see https://www.kiwi.fi/pages/viewpage.action?pageId=30114779 for internal instructions page)
-
Fix the MAMPStack installation with the following commands (see https://miscandrandom.wordpress.com/2017/02/04/installing-xdebug-or-other-extensions-in-mampstack-7-0-or-7-1/ for more information) in terminal (N.B. the commands are now for PHP 7.4, change mamp74stack to e.g. mamp73stack as necessary):
/Applications/mampstack/use_mampstack cd $BITNAMI_ROOT/common/lib chmod u+w *.dylib for i in *.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/php/bin/php.bin; done install_name_tool -change @rpath/libzip.5.dylib $BITNAMI_ROOT/common/lib/libzip.5.dylib $BITNAMI_ROOT/php/bin/php.bin for i in *.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/common/bin/envsubst; done for i in *.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/common/bin/ngettext; done for i in *.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/git/bin/.origin/git; done for i in *.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/php/lib/php/extensions/mongodb.so; done for f in lib*.dylib; do for i in lib*.dylib; do install_name_tool -change /bitnami/mamp74stack-osx-x64/output/common/lib/$i $BITNAMI_ROOT/common/lib/$i $f; done; done for i in *.dylib; do install_name_tool -change $i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/php/lib/php/extensions/intl.so; done for i in *.dylib; do install_name_tool -change $i $BITNAMI_ROOT/common/lib/$i $BITNAMI_ROOT/php/lib/php/extensions/mongodb.so; done pear config-set cache_dir /tmp/pear/cache pear config-set download_dir /tmp/pear/download pear config-set temp_dir /tmp/pear/temp
-
Install the xdebug extension:
pecl install xdebug
If you get an error like 'Cannot find autoconf. - - ERROR: `phpize' failed' see e.g. http://stackoverflow.com/questions/9322742/php-autoconf-errors-on-mac-os-x-10-7-3-when-trying-to-install-pecl-extensions/9527180
or just install autoconf from source:
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz tar xzf autoconf-latest.tar.gz cd autoconf-* ./configure --prefix=/usr/local make sudo make install
Now rerun 'pecl install xdebug'.
If you encounter trouble with running e.g. composer update
, make sure to rerun the commands from step 11. E.g. a module updated using pecl may get bad paths.
This typically manifests as composer complaining about a missing extension like "the requested PHP extension mongodb is missing from your system." all the while you can clearly see with php -i
that the extension is present.
-
Stop any services from the previous MAMPStack version.
-
Install the new MAMPStack alongside the old one.
-
Remove old ~/.pearrc
-
Do modifications from steps 2-5, 11 and 12 in the installation instructions to the new version.
-
Copy over files from old MAMPStack's php/etc/php.d/ and apache2/conf.d/ to the new one.
-
Fix any paths in the copied files (e.g. path to xdebug.so).
-
Copy over directory mysql/data from the old one to the new one (overwrite the existing directory in the new version).
-
Start MySQL of the new MAMPStack version.
If MySQL doesn't start, you may need to remove old InnoDB log files (make sure that MySQL was properly shut down in the older version -- otherwise some data may be lost):
rm /Applications/mampstack/mysql/data/ib_logfile*
-
This is only needed with older MySQL versions: Execute use_mampstack in the new version and run the following command to upgrade the MySQL database (edit the path accordingly and enter your MySQL root password when prompted):
mysql_upgrade -S /Applications/mampstack/mysql/tmp/mysql.sock -u root -p
-
Reinstall oci8 (see below) if you need it
(Adapted from https://vufind.org/wiki/installing_the_php_oci_driver_for_oracle, https://gist.github.com/gido/5237100, http://antistatique.net/blog/2013/03/25/install-php-oracle-oci-extension-11-2-on-mac-os-x-10-8/, http://unabletoremember.blogspot.fi/2013/03/mampstack-5322-0-and-oci8-oracle-on-osx.html)
-
Install Xcode command line tools by running the following command in a terminal:
xcode-select --install
If the installation fails complaining that the software is currently not available from the software update server, here is a direct link for the download: https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-
-
Download MAC OS X x64 versions of Oracle InstantClient packages basic and sdk from http://www.oracle.com/technetwork/database/features/instant-client/index.html (click "See Instant Client downloads" and navigate from there on).
-
Extract the packages to /usr/local. instantclient_12_2 directory will be created (adjust as necessary for different versions):
cd /usr/local sudo unzip ~/Downloads/instantclient-basic-macos.x64-12.2.0.1.0-2.zip sudo unzip ~/Downloads/instantclient-sdk-macos.x64-12.2.0.1.0-2.zip
-
Create symlinks so that the system can see the libraries and headers:
sudo ln -s /usr/local/instantclient_12_2/sdk/include/*.h /usr/local/include/ sudo ln -s /usr/local/instantclient_12_2/*.dylib /usr/local/lib/
-
Run MAMPStack's use_mampstack script
-
Enter the following command to install oci8 support for PHP:
pecl install oci8
When prompted for the path to ORACLE_HOME, enter:
instantclient,/usr/local/instantclient_12_2
If the above commands fail with a perl error, upgrade to a new MAMPStack version and try again.
Add the newly created extension to /Applications/mampstack/php/etc/php.d/oci8.ini:
echo extension=oci8.so > /Applications/mampstack/php/etc/php.d/oci8.ini
-
Modify /Applications/mampstack/apache2/bin/envvars and add the following line as the last line of the file (otherwise the connection might fail due to something or the other not finding the libraries):
export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:/usr/local/instantclient_12_2/"
-
Phew, it's done!