MythWeb via MacPorts
This page assumes that you have used MacPorts to install the Myth backend and database on an OS X machine and now want to serve MythWeb from the same machine. Other configurations are possible but are left as an exercise for the reader!
Contents
Installation
MythWeb is now available for installation via MacPorts. If you haven't done so already, you must have Apple's XCode and the MacPorts application installed. See the MacPorts web site for instructions.
Install MythWeb and supporting software
Choose the version of MythWeb that matches your installed version of Myth. Use Terminal to run the following commands:
At the Terminal prompt, you enter | What happens |
sudo port install mythweb.27or sudo port install mythweb.26or sudo port install mythweb.25 |
Download, build and install the MythWeb and supporting software. The first time, it may require several minutes to download, build and install the MacPorts versions of Apache2 and PHP5. |
Configure Apache and PHP
Based on: https://trac.macports.org/wiki/howto/MAMP
You must enter a series of commands in Terminal and modify a couple of configuration files with a text editor (such as TextEdit or TextWrangler).
Register PHP with Apache
In Terminal, enter:
cd /opt/local/apache2/modules sudo /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
Edit Apache's http.conf
You will probably need to change the permissions on the http.conf file in order to edit the file:
sudo chmod 666 /opt/local/apache2/conf/httpd.conf
Using a text editor, update /opt/local/apache2/conf/httpd.conf file to extend the "DirectoryIndex" directive to include additional "index" files. Search for:
DirectoryIndex index.html
and change it this way:
DirectoryIndex index.php index.html
Also, at the end of the httpd.conf file, add the following lines so that Apache includes the mod_php "AddType" configurations and MythWeb's configuration file:
# # Include PHP configurations # Include conf/extra/mod_php.conf # # MythWeb config Include htdocs/MythWeb/mythweb.conf
If you have a lower-end machine running Apache/PHP/MythWeb, you may find that the default settings use memory pretty aggressively. Since we're only likely to be accessing MythWeb from a small number of computers--and seldom simultaneously--I found adding the following configuration values to httpd.conf helpful:
# # MythWeb optional - Ease Apache memory demands # StartServers 1 MinSpareServers 1 MaxSpareServers 4 MaxClients 7 MaxRequestsPerChild 300
based on http://emergent.urbanpug.com/?p=60
Modify PHP configuration
In Terminal, enter:
cd /opt/local/etc/php5 sudo cp php.ini-development php.ini
Setup the MySQL default socket to use the MacPorts configuration (/opt/local/var/run/mysql5/mysqld.sock)
$ sudo -i # cd /opt/local/etc/php5 # cp php.ini php.ini.bak # defSock=`/opt/local/bin/mysql_config5 --socket` # cat php.ini | sed \ -e "s#pdo_mysql\.default_socket.*#pdo_mysql\.default_socket=${defSock}#" \ -e "s#mysql\.default_socket.*#mysql\.default_socket=${defSock}#" \ -e "s#mysqli\.default_socket.*#mysqli\.default_socket=${defSock}#" > tmp.ini # grep default_socket tmp.ini # Check it! # mv tmp.ini php.ini # exit # OR rm php.ini.bak && exit
Restart Apache so that your changes take effect
sudo port unload apache2; sudo port load apache2
Configure MythWeb
MythWeb works 'out of the box'. To do: determine if any more configuration is necessary or desirable.
Accessing MythWeb
http://localhost/MythWeb or http://web.server.ip/MythWeb
Troubleshooting
404 Not Found
Check Console.app, under the /var/log section for an apache2 error log. If you see lines like "File does not exist: /Library/WebServer/Documents/MythWeb", the Apache software built into OS X is intercepting the web request and isn't configured to handle it. Be sure that MacPorts Apache2 is the only one running; not the version built into OS X. Prior to Mountain Lion, go into the System Preferences>Sharing and ensure Web Sharing is not clicked. For Mountain Lion (OS X 10.8.x), search the web for instructions on enabling/disabling web sharing.