INSTALL.txt 12/18/2004 PrivateRadio Version 2.0 Contact Point: johnnymc -at- privateradio.org more info at www.privateradio.org Installation of the system takes just a few minutes for experienced users. Your mileage may vary. PrivateRadio must run as a base website, meaning you can't install in a folder on your web tree. You must dedicate a host name. But this is easy. For the instructions here we are going to assume you have chosen jukebox.privateradio.org as the server name. please substiture your own host name. If this is confusing and/or for tips on setting up a virtual host, see the FAQ at http://www.privateradio.org/blog/prirad/faq.php PREREQUISITES ---------------------------------------- Unix or Windows XP apache 1.3.x or 2.x php 4 or 5 mysql mplayer or alsaplayer or some other mp3/flac/wav player like winamp. OPTIONAL BUT NEEDED FOR SOME STUFF zip (unix) or zip.exe (windows) aumix (optional, for linux mixer control only) php needs to be installed as an apache module AND you also need the cgi/binary version of php available to the system. For win32 this is typically c:\php\php.exe and for unix it might be /usr/bin/php. Additionally this php binary must have mysql support (most do). OK, now if you are running on windows you have to make a copy of your php.exe. Easy, if your php.exe is in c:\php just copy c:\php\php.exe c:\php\pr-php.exe. The specially named binary is necessary so that the system can identify it's own scripts. At any rate the php binary needs to be in your path. How to find out? From the shell just type php. If you don't get an error, you have a php binary. PHP CONFIGURATION ---------------------------- your php should NOT be running in safe_mode, but most installs aren't so you should be fine. UNPACK THE DISTRIBUTION ----------------------------- Optionally, add a user to the system. I like to use 'music'. It will be easier to manage the scripts if they all run from this user space. Unpack the distribution into a desired location. The default location is '/prirad' and is recommended and this will be used for all of the examples and config defaults. You should end up with something like this: /prirad/html <-- where the web stuff lives /prirad/bin <-- the local player, playlist scripts and other stuff lives here /prirad/tmp <-- needed by the system to hold temp stuff /prirad/incoming <-- needed by the system to merge incoming songs Check/Setup the appopriate permissions for the directories. The web server obviously needs to have read permissions for everything under html. But it needs write permission to some areas, notably /prirad/tmp,/prirad/incoming and /prirad/html/img. And it needs execute permissions to /prirad/bin. On unix systems, the quick and dirty way would be (from /prirad): chmod -R o+rwx html/img chmod o+rwx incoming chmod o+rwx tmp On windows systems it could be easier or trickier to setup permissions, chances are you will be fine - you know your system right?...... SETUP MYSQL DATABASE ----------------------- From a console: cd to the install point (usually /prirad) mysqladmin create privateradio mysql privateradio < prirad-mysql.init you now have the initial tables setup... now, edit the file 'inc/dbconfig.php' This file contains the server machine,username, password, database settings for access to the mysql server. dbconfig.php is the main entry point for everything - so get this part right! You will need to change the appropriate entries to allow access to your mysql server. SET UP YOUR APACHE CONFIGURATION ----------------------------------- You will need to modify your httpd.conf configuration file. Following is a sample apache configuration snippet. You will want to read it carefully and comment/uncomment lines depending on your system -- unix or win32 and apache 1.3 or apache 2. You will also want to get ServerName exactly right for your host. This has been tested under apache versions 1.3.xx for win32 and linux and for apache 2.0.x as well. The key diff on apache 2 vs 1 is server directive 'AcceptPathInfo On' which will give you an error in 1.3.x but is necessary in 2.0.x, this is all documented in the config snippet below. APACHE CONFIG This is assuming your host is jukebox.privateradio.org For your apache configuration you have to have NamedVirtualHosts. This is easy with this directive. NameVirtualHost *:80 Then you need an entry like this: ServerAdmin webmaster@privateradio.org DocumentRoot /prirad/html ServerName jukebox.privateradio.org ServerAlias mystuff.privateradio.org # comment out next line for apache 1.3.x AcceptPathInfo On # if your system is working you may wish to turn off logging # UNIX #ErrorLog /dev/null #CustomLog /dev/null common # WINDOWS #ErrorLog NUL #CustomLog NUL common ## now for the fun part, you don't really need all these, but you must have .php AddType application/x-httpd-php .php .phtml .php3 .html .htm DirectoryIndex index.php ## we setup an include path for this host ## for win32 use the following #php_value include_path "\.;/prirad/inc" ## for unix systems use this: php_value include_path ".:/prirad/inc" # leave these alone php_value auto_prepend_file "prepend.php" php_value short_open_tag off php_value register_globals on php_flag track_vars on php_flag magic_quotes_gpc on # some apache permissions Options All -Indexes AllowOverride All # some special hacks, Yes, they are necessary Options All -Indexes AllowOverride All Order allow,deny Allow from all ForceType application/x-httpd-php ForceType application/x-httpd-php ForceType application/x-httpd-php ForceType application/x-httpd-php DONE WITH APACHE CONFIGURATION Now refire your apache server: /etc/init.d/httpd restart or for windows net stop apache net start apache YOU DID IT ----------- set your browser to point at ServerName and you should now see some welcome screens and further instructions. Read the pages on the site for more help. You will want to visit the admin section (especially configuration) to set up your site. I've tried to put most of the documentation right in there with the configuration screens. GET SOME MUSIC INTO THE SYSTEM ------------------------------ You will want to get some files into /prirad/incoming. Then from the admin screens (incoming music) on the website add them to your system. LAUNCH THE PHP DAEMONS ---------------------- WARNING: Don't launch the daemons until you have at least 10 or so songs in your system. Why? They expect to find something in the songs data table. There are at least four daemons that run and do things. pr-queue.php <-- manages the jukebox queues and keeps them pre-stuffed with songs. pr-play.php <-- fires and controls the local player daemon that plays the music out the local machine sound card pr-commands.php <-- controls pr-play and player binary, and other root type stuff pr-monitor.php <-- monitors the scripts There are some control scripts (go-unix.sh, go-unix-root.sh and go-win.cmd) that you can look at that help you launch all of these at once. IMPORTANT pr-queue, pr-play and pr-commands should always be running for the prirad system to work pr-play.php must have permission to access and run the player program (typically mplayer) pr-commands.php must have permission to access the mixer (volume control, treble, etc) and should be able to kill or terminate the player process. It also needs to have read access to any media files you want to link in. I run pr-commands.php as root (yikes, sue me!). See go-unix-root.sh LAUNCHING SYSTEM AS A SERVICE When confident in the operation, you will want to lauch the system as a service on startup. For linux see prirad-init in the bin folder, you will want to put this in /etc/init.d For windows you will want to install the service like this: cd \prirad prirad-service.exe install When prirad-service launches it will run svc-start.cmd and when it stops svc-end.cmd Edit svc-start.cmd and svc-end.cmd as appropriate to your tastes to unininstal prirad-service.exe uninstall Initially the system starts as a single user open system with no security. To change this go to admin/general tab. The default credentials for the admin is: First: super Last: user secret: password ** NOTE ** do not delete the first to records in the members table member #1 is the site administrator and member #2 is needed by the player scripts Enjoy