In my last blog I showed how I installed a MythTV backend PVR server into a FreeNAS Jail.
A must-have for usability is the Mythweb HTTP-based configuration tool. There’s a lot of hoops to jump through, but you should hopefully make it through unscathed!
Install Mythweb and Dependencies
pkg install mythplugin-mythweb
For me this says that it will install the following:
New packages to be INSTALLED: mythplugin-mythweb: 0.27_1 php56-session: 5.6.7 php56: 5.6.7 apache24: 2.4.12 php56-posix: 5.6.7 php56-json: 5.6.7 php56-mysql: 5.6.7
Since it is installing PHP 5.6, you’ll need the “56” version of mod_php as well:
pkg install mod_php56
There are important messages from the installs (shown here) which we’ll address below:
Message for apache24-2.4.12: To run apache www server from startup, add apache24_enable="yes" in your /etc/rc.conf. Extra options can be found in startup script. Your hostname must be resolvable using at least 1 mechanism in /etc/nsswitch.conf typically DNS or /etc/hosts or apache might have issues starting depending on the modules you are using. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - apache24 default build changed from static MPM to modular MPM - more modules are now enabled per default in the port - icons and error pages moved from WWWDIR to DATADIR If build with modular MPM and no MPM is activated in httpd.conf, then mpm_prefork will be activated as default MPM in etc/apache24/modules.d to keep compatibility with existing php/perl/python modules! Please compare the existing httpd.conf with httpd.conf.sample and merge missing modules/instructions into httpd.conf! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Message for mythplugin-mythweb-0.27_1: mythweb has been installed into: /usr/local/www/mythweb You need to configure mythweb now according to the instructions in /usr/local/www/mythweb/INSTALL For lighttpd you should have a look at the MythTV Wiki http://www.mythtv.org/wiki/MythWeb_on_Lighttpd Message for mod_php56-5.6.7: *************************************************************** Make sure index.php is part of your DirectoryIndex. You should add the following to your Apache configuration file: <FilesMatch ".php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch ".phps$"> SetHandler application/x-httpd-php-source </FilesMatch> ***************************************************************
/etc/rc.conf" with the following:
/etc/hosts" to something similar to the below – changing the parts in red to suite your IP, hostname and domain:
127.0.0.1 localhost localhost.localdomain mythserver mythserver.gavowen.local 10.69.10.22 mythserver mythserver.gavowen.local
You can choose to put your mythweb into the root of the web server, but I prefer to put it off to the side it its own “mythweb” directory.
Copy the mythweb files to where the web server can use them:
mkdir /usr/local/www/apache24/data/mythweb cp -R /usr/local/www/mythweb/* /usr/local/www/apache24/data/mythweb
Apache 2.4 runs as user and group “www” on FreeBSD/FreeNAS, so update the permissions accordingly:
chgrp -R www /usr/local/www/apache24/data chmod -R g+rw /usr/local/www/apache24/data
I copied mine into my jail, then across to MythWeb’s TV icons directory:
cp /mnt/storage/channelicons/* /usr/local/www/apache24/data/mythweb/data/tv_icons
Mythweb Apache Config File
The Mythweb Apache config file (“
/usr/local/www/apache24/data/mythweb/mythweb.conf.apache“) is a bit out of date for Apache 2.4 and PHP 5.6, so pull down the latest version directly to the directory you need it in.
cd /usr/local/etc/apache24/extra/ wget --no-check-certificate https://raw.githubusercontent.com/MythTV/mythweb/master/mythweb.conf.apache cp /usr/local/etc/apache24/extra/mythweb.conf.apache /usr/local/etc/apache24/extra/mythweb.conf
Edit the “
mythweb.conf" file and change the following:
<Directory “/var/www/html/data”> to <Directory “/usr/local/www/apache24/data/mythweb/data”> and <Directory “/var/www/html”> to <Directory “/usr/local/www/apache24/data/mythweb”>
My NAS has plenty of RAM, so I increase the PHP “php_value memory_limit” to 256M. Save the file and quit.
Make sure these lines are uncommented:
setenv db_server "localhost" setenv db_name "mythconverg" setenv db_login "mythtv" setenv db_password "mythtv"
Backup Apache’s original config file before editing “
cp /usr/local/etc/apache24/httpd.conf /usr/local/etc/apache24/httpd.conf.original
Uncomment all these mods. The first two are usually on by default:
mod_env mod_headers mod_rewrite mod_deflate mod_auth_digest
Uncomment ServerName and change it to match what you’ve done previously in “
In the “Supplemental Configuration” of the file, I place the following two lines:
# Mythweb configuration Include etc/apache24/extra/mythweb.conf
Further down you’ll find the DirectoryIndex, where I add “index.php”
<IfModule dir_module> DirectoryIndex index.php index.html </IfModule>
Directly below that part I add the following:
<FilesMatch ".php$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch ".phps$"> SetHandler application/x-httpd-php-source </FilesMatch>
service apache24 start
Now open a browser. Enjoy.
NB: Subsequent restarts of apache can be done with “
If the page doesn’t load try this:
create user 'mythtv'@'127.0.0.%' identified by 'mythtv'; create user 'mythtv'@'127.0.1.%' identified by 'mythtv'; set password for 'mythtv'@'127.0.0.%' = password('mythtv'); set password for 'mythtv'@'127.0.1.%' = password('mythtv'); connect mythconverg; grant all privileges on *.* to 'mythtv'@'127.0.0.%' with grant option; grant all privileges on *.* to 'mythtv'@'127.0.1.%' with grant option; flush privileges; exit;
There are other possible issues addressed at this link.
You might get a warning such as:
User Notice at /usr/local/share/mythtv/bindings/php/MythBackend.php, line 132: !!NoTrans: Failed to set php timezone to AEST Response from backend was Array (  => AEST  => 36000  => 2015-04-25T10:14:06Z ) !! Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/mythweb/includes/errors.php on line 161
If that’s the case I find installing NTP a good solution:
pkg install ntp
/etc/rc.conf" with the following:
Then start it with “
service ntpd start". Issue “
date" to see that it’s accurate. Then:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
search for “date.timezone” and change it to suit. For me it’s
date.timezone = "Australia/Melbourne"
Do you have any advice for getting the ASX and Direct Download working. I get a 404 error whenever I try to use those features.
Sorry I don’t. I gave up on MythTV and only use tvheadend now.
Am I correct that there is no TVH port for FreeNAS yet?
I actually got it installed and working in a FreeNAS jail, so you can get it working, but it doesn’t have native support for the HDHomeRun TV tuner like Myth does unfortunately. When you compile with HDHomeRun support, it then grabs the Linux drivers online and compiles them, but this isn’t going to work on a *BSD platform like FreeNAS.
In the end I found my choices really boiled down to MythTV in FreeNAS jail, MythBuntu, or TVheadend + Ubuntu. I decided to go the latter, and in a separate ESXi server install on a different machine, although I could have installed VirtualBox in a FreeNAS jail if this was my only server.
Another great help. Thanks!