None Mamp install on OS X: Difference between revisions
No edit summary |
Tim Bahula 2 (talk | contribs) m (clean up, typos fixed: apache → Apache (2), Don’t → Don't, e.g → e.g. (2)) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Yosemite native OSX install | ==Yosemite native OSX install== | ||
This page is for people who want to do an OSX install without using someone else's packaging. | This page is for people who want to do an OSX install without using someone else's packaging. | ||
There are some warning to bear in mind. | |||
A native install of Moodle on an OSX machine is not really suitable as an internet linked live server but it is great for testing and development. The OS X install described here is essentially the same as a Linux install and so the advice there can be applied here also Apple does not keep Apache and php up to date on a standard OS X install. | |||
Most of this | Most of this work is via the cli which you can use in the ‘terminal’ application. To edit files, use nano or vi. Mostly you need to be root to edit the files so precede your editor name by sudo. | ||
e.g sudo nano /etc/apache2/httpd.conf | e.g. sudo nano /etc/apache2/httpd.conf or sudo vi /etc/apache2/httpd.conf | ||
If you are doing any kind of development on an mac then consider an installation of XCode which will install all sorts of odds and ends that you are likely to need now and then such as libraries for php etc. | If you are doing any kind of development on an mac then consider an installation of XCode which will install all sorts of odds and ends that you are likely to need now and then such as libraries for php etc. | ||
e.g sudo nano /etc/apache2/httpd.conf | e.g. sudo nano /etc/apache2/httpd.conf | ||
Enable Apache. | =Enable Apache.= | ||
Apache is already installed and you need to start it and test it works. Start | Apache is already installed and you need to start it and test it works. Start Apache via this command. | ||
sudo apachectl start | sudo apachectl start | ||
Line 25: | Line 25: | ||
at the time of writing 01/09/2015 this test was passed by Safari, Firefox and Chrome. | at the time of writing 01/09/2015 this test was passed by Safari, Firefox and Chrome. | ||
Making “Sites” work (Optional) | The default Apache user is "_www" and so your moodledata folder needs write permissions for the _www user. | ||
sudo chown <username>:_www moodledata | |||
In the finder, choose the folder and using the get info dialogue to give _www write access to the folder. | |||
=Making “Sites” work (Optional)= | |||
Mac users are used to having a Sites folder which publishes a local-users web site on http://<host url address>/~<UserName> | Mac users are used to having a Sites folder which publishes a local-users web site on http://<host url address>/~<UserName> | ||
Line 32: | Line 38: | ||
edit <username>.conf | edit <username>.conf | ||
with these contents. | with these contents. Don't forget to change <username> for your username. | ||
<Directory "/Users/<username>/Sites/"> | <Directory "/Users/<username>/Sites/"> | ||
Line 41: | Line 47: | ||
Making php etc | =Making php etc work= | ||
in /etc/apache2/httpd.conf uncomment all the following lines | in /etc/apache2/httpd.conf uncomment all the following lines | ||
Line 50: | Line 56: | ||
Include /private/etc/apache2/extra/httpd-userdir.conf | Include /private/etc/apache2/extra/httpd-userdir.conf | ||
Test php. | =Test php.= | ||
Make a file in the root of your webfolder called phpinfo.php and add this content. | Make a file in the root of your webfolder called phpinfo.php and add this content. | ||
Line 57: | Line 63: | ||
Then, visit the site by url httpd://localhost/<your user name>/phpinfo.php | Then, visit the site by url httpd://localhost/<your user name>/phpinfo.php | ||
This should give you the well | This should give you the well known phpinfo page. The most likely error will be a page just showing the text <?php phpinfo(); ?> which means php is not working. | ||
Mysql | =Mysql= | ||
Download your version of Mysql from the Mysql site http://dev.mysql.com/downloads/mysql/ | Download your version of Mysql from the Mysql site http://dev.mysql.com/downloads/mysql/ | ||
Line 65: | Line 71: | ||
The dmg install will put a system settings item enabling Mysql to be started/stopped. If you tick the option to start on boot then it may not actually start on boot. This is an on-off issue with OSX. | The dmg install will put a system settings item enabling Mysql to be started/stopped. If you tick the option to start on boot then it may not actually start on boot. This is an on-off issue with OSX. | ||
If you are not running OSX server then you will need to install Mysql again if Apple issue an upgrade of | If you are not running OSX server then you will probably need to install Mysql again if Apple issue an upgrade of Yosemite. | ||
[[Category: | [[Category:Installation]] |
Latest revision as of 14:24, 22 September 2021
Yosemite native OSX install
This page is for people who want to do an OSX install without using someone else's packaging. There are some warning to bear in mind. A native install of Moodle on an OSX machine is not really suitable as an internet linked live server but it is great for testing and development. The OS X install described here is essentially the same as a Linux install and so the advice there can be applied here also Apple does not keep Apache and php up to date on a standard OS X install.
Most of this work is via the cli which you can use in the ‘terminal’ application. To edit files, use nano or vi. Mostly you need to be root to edit the files so precede your editor name by sudo.
e.g. sudo nano /etc/apache2/httpd.conf or sudo vi /etc/apache2/httpd.conf
If you are doing any kind of development on an mac then consider an installation of XCode which will install all sorts of odds and ends that you are likely to need now and then such as libraries for php etc.
e.g. sudo nano /etc/apache2/httpd.conf
Enable Apache.
Apache is already installed and you need to start it and test it works. Start Apache via this command.
sudo apachectl start
If you want it to start on boot then issue this command
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Test this by going to http://localhost on a browser.
at the time of writing 01/09/2015 this test was passed by Safari, Firefox and Chrome.
The default Apache user is "_www" and so your moodledata folder needs write permissions for the _www user.
sudo chown <username>:_www moodledata
In the finder, choose the folder and using the get info dialogue to give _www write access to the folder.
Making “Sites” work (Optional)
Mac users are used to having a Sites folder which publishes a local-users web site on http://<host url address>/~<UserName>
cd /etc/apache2/users edit <username>.conf
with these contents. Don't forget to change <username> for your username.
<Directory "/Users/<username>/Sites/"> AllowOverride All Options Indexes MultiViews FollowSymLinks Require all granted </Directory>
Making php etc work
in /etc/apache2/httpd.conf uncomment all the following lines
LoadModule authz_core_module libexec/apache2/mod_authz_core.so LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule userdir_module libexec/apache2/mod_userdir.soLoadModule php5_module libexec/apache2/libphp5.so Include /private/etc/apache2/extra/httpd-userdir.conf
Test php.
Make a file in the root of your webfolder called phpinfo.php and add this content.
<?php phpinfo(); ?>
Then, visit the site by url httpd://localhost/<your user name>/phpinfo.php
This should give you the well known phpinfo page. The most likely error will be a page just showing the text <?php phpinfo(); ?> which means php is not working.
Mysql
Download your version of Mysql from the Mysql site http://dev.mysql.com/downloads/mysql/ and install it! The dmg install will put a system settings item enabling Mysql to be started/stopped. If you tick the option to start on boot then it may not actually start on boot. This is an on-off issue with OSX.
If you are not running OSX server then you will probably need to install Mysql again if Apple issue an upgrade of Yosemite.