Mountaain Lion Install

brucecbarton wrote on Thursday, May 30, 2013:

Here is what I did. I did it on a Mountain Lion Server, but I add the changes for a non-server install. I did not test the non-server install.

From:http://akrabat.com/computing/setting-up-php-mysql-on-os-x-10-8-mountain-lion/

  1. Enable the root user:
    Open System Preferences
    Select Users & Groups
    Click the lock if it is locked and enter your password.
    Select Login Options.
    Click the Edit… button next to Network Account Server:
    In the dialog box, select Open Directory Utility… .

In the Directory Utility click the lock if it is locked and enter your password.
Under the Edit menu, if Enable Root User is available, select it and enter a password, I just use the same one as my login.

Quit Directory Utility and System Preferences

1)Install MySQL 5.6.xx (5.7 has just came out, but Iused the newest 5.6 version).
Download mysql-5.6.11-osx10.7-x86_64.dmg for OS X from mysql.com
Double click to open the disk image.
Install the mysql-5.6.11-osx10.7-x86_64.pkg.
Install the MySQLStartupItem.pkg.
Double click the MySQL.prefPane.
I selected Install for all users of this computer and clicked Install.
Make sure Automatically Start MySQL Server on Startup is checked and The MySQL Server Instance is Running

3)Now set some MySQL things using the Terminal in the utilities folder under Applications
A)Add /usr/local/mysql/bin to the path with the following command:
echo “export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH” > ~/.bash_profile
B) Set the path now with this command.
export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

C) Set up MySQL root password with the following commands, do not include the {}:
(Note: this is not the most secure method because the password for MySQL is on the command line).
mysqladmin -u root password {new-password}
mysqladmin -u root -p{new-password} -h localhost password {new-password}
mysqladmin -u root -p{new-password} reload

D. Clear the history file by typing history -c so that {new-password} isn’t in plain text on the disk:
history -c

E) Now ensure that the mysql.sock file can be found by PHP:, in Terminal type:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Secure MySQL

  1. In terminal:
    mysql -u root -p{new-password}
  2. At the mysql>
    DELETE FROM mysql.user WHERE user = ‘’;
    FLUSH PRIVILEGES;
    quit;

Apache, the web server program.
In the non Server version:
Apple have removed the “Web Sharing” feature from System Preferences, but Apache is still installed. We just have to use the command line now to start and stop it.

All:

  1. Change to the web server directory, in Terminal type:
    cd /private/etc/apache2

  2. Give write permission the config file to root, in Terminal type:
    sudo chmod u+w httpd.conf

  3. Open the file, in Terminal type:
    sudo open -e httpd.conf

  1. In the just opened TextEdit window:
    Find #LoadModule php5_module libexec/apache2/libphp5.so and remove the leading #
    TextEdit will ask you to Duplacate it, click OK.

  2. Find AllowOverride None within the <Directory “/Library/WebServer/Documents”>section and change AllowOverride from None to All so that .htaccess files will work.

  3. In the TextEdit File menu, Save. Change the name from httpd copy to httpd.conf. Don’t forget to unclick the “If no extension is provided, use “.txt”” box. Save to the Documents folder.

  4. Copy the file back in Terminal with the following command:
    sudo cp ~/Documents/httpd.conf /private/etc/apache2/

  5. Change owner back in terminal:
    sudo chown root:wheel /private/etc/apache2/httpd.conf

  6. Change permissions back:
    sudo chmod u-w /private/etc/apache2/httpd.conf

  7. Restart Apache:
    sudo apachectl restart

It you are running Server:
11. Open Finder and navigate to /Library/Server/Web/Data/Sites/Default

  1. CTRL click on info.php and open it with TextEdit

  2. Remove the two // before phpinfo();.

  3. TextEdit will ask you to Duplacate it, click OK.

  4. Save. Change the name from info copy to info.php. Don’t forget to unclick the “If no extension is provided, use “.txt”” box. Save to the desktop.

  5. Drag it to the open /Library/Server/Web/Sites/Default folder. Replace.

  6. Open the Server app. Enable Websites and check the “Enable PHP web Applications” and the “Enable Python web Applications” boxes.


18. Click View Server Website

For Non Server:
11. Open Finder and navigate to /Library/WebServer/Documents/ using shift+cmd+g

12.Create a new folder called “orig” and place all files currently in the Documents folder into it.
(note that it will ask for your password as the Documents folder is only writable by root.

  1. In TextEdit: Create a new file with <?php phpinfo();?> inside it.
    Make it plain text and save it as info.php on the desktop. Don’t forget to unclick the “If no extension is provided, use “.txt”” box.

  2. Drag the file to the open /Library/WebServer/Documents/ folder.

  3. Ensure that Apache will start after a reboot, in terminal:
    sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

For all:
16/19. Use Safari to navigate to http://localhost/info.php and check that the PHP version is displayed (5.3.15 at the time of writing). Also scroll down and look for the mysql Client API version.

Time to edit php.ini

  1. Change to the php.ini directory, in Terminal:
    cd /private/etc

  2. For the Non Server users, create the php.ini file, in Terminal:
    sudo cp php.ini.default php.ini

  3. Give write permission the config file to root, in Terminal type:
    sudo chmod ug+w php.ini

  4. Open the file, in Terminal type:
    open -e php.ini

  5. Change the following: TextEdit will ask you to Duplacate it, click OK.
    short_open_tag = On
    max_execution_time = 60
    max_input_time = 90
    post_max_size = 30M
    upload_max_filesize = 30M

Also, change all instances of /var/mysql/mysql.sock to /tmp/mysql.sock (3 places for me)
Remove the semicolon at the start of:
;zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
Add to the following to the [xdebug] section at the end of the fife.
xdebug.var_display_max_children = 999
xdebug.var_display_max_data = 99999
xdebug.var_display_max_depth = 100

And check the following values:
memory_limit = 128M
display_errors = Off
log_errors = On
register_globals = Off
file_uploads = On
html_errors = Off

  1. In the TextEdit File menu, Save. Change the name from php copy to php.ini. Don’t forget to unclick the “If no extension is provided, use “.txt”” box.
    Save to the Documents folder.

  2. Copy the file back in terminal:
    sudo cp ~/Documents/php.ini /private/etc/php.ini

  3. In terminal, change the owner back to root and the group to staff:
    sudo chown root:staff /private/etc/php.ini

Now for OpenEMR

  1. In TextEdit select New from the File menu.
    Under the Format menu, select make plain text.
    Cut and paste the following in the the new window:

Server Version:
<Directory /Library/Server/Web/Data/Sites/Default/openemr-4.1.1/sites//documents>
order deny,allow
Deny from all

<Directory /Library/Server/Web/Data/Sites/Default/openemr-4.1.1/sites/
/edi>
order deny,allow
Deny from all

<Directory /Library/Server/Web/Data/Sites/Default/openemr-4.1.1/sites//era>
order deny,allow
Deny from all

NonServer version:
<Directory /Library/WebServer/Default/openemr-4.1.1/sites/
/documents>
order deny,allow
Deny from all

<Directory /Library/WebServer/Default/openemr-4.1.1/sites//edi>
order deny,allow
Deny from all

<Directory /Library/WebServer/Default/openemr-4.1.1/sites/
/era>
order deny,allow
Deny from all

In the TextEdit File menu, Save. Change the name to openemr.conf. Don’t forget to unclick the “If no extension is provided, use “.txt”” box. Save to the Documents folder.

  1. Save it on the desktop and move it to /private/etc/apache2/sites in Terminal type:
    sudo cp ~/Documents/openemr.conf /private/etc/apache2/other/openemr.conf

Server:
3. In the Finder: Go->Go to Folder->/Library/Server/Web/Data/Sites/

Non Server
3. In the Finder: Go->Go to Folder->/Library/WebServer

All:
4. Get Info for Default. Mine is: system Read & Write; wheel Read only; everyone Read only
Click the lock and change all of them to Read & Write

  1. Open the Default folder.

  2. In Safari go to: http://open-emr.org/wiki/index.php/OpenEMR_Downloads

  3. Download the openemr-4.1.1.tar.gz file under the Linux section.

  4. Move the file from the Downloads folder to the open Default folder.

  5. Double click the file to expand it.

  6. Change to the Web directory, in Terminal type:
    Server:
    cd /Library/Server/Web/Data/Sites/Default
    Non Sever:
    cd /Library/WebServer/Default

All:
10. Set up links for easy web access, in Terminal type:
ln -s openemr-4.1.1 openemr

  1. Set owner and permissions in Terminal type:
    cd openemr
    sudo chmod 666 library/sqlconf.php
    sudo chmod 666 interface/globals.php
    sudo chown -R _www:_www sites
    sudo chown -R _www:_www library/freeb
    sudo chown -R _www:_www gacl/admin/templates_c
    sudo chown -R _www:_www interface/main/calendar/modules/PostCalendar/pntemplates/cache
    sudo chown -R _www:_www interface/main/calendar/modules/PostCalendar/pntemplates/compiled

Install Firefox.

Open Firefox and start the installation script at http://localhost/openemr/setup.php

When done, change back Sharing & Permissions on /Library/Server/Web/Data/Sites/Default.
You may want to disable the root user in the Directory Utility.

Good luck and enjoy.

bradymiller wrote on Monday, June 03, 2013:

Hi Bruce,

These are excellent instructions. To ensure they become immortalized, please place them on the wiki here:
http://www.open-emr.org/wiki/index.php/OpenEMR_Installation_Guides

To get a wiki account, place info here (and I’ll gladly confirm the account):
http://www.open-emr.org/wiki/index.php/Special:RequestAccount

-brady
OpenEMR