Tuesday, 17 February 2015

Installing PHPMotion Media Sharing on Ubuntu 12.04 or Later

 Installing PHPMotion Media Sharing on Ubuntu 12.04 or
Later
PHPMotion is a video sharing application and it also has functionalities for sharing images and
music.
In this document I will install PHPMotion in an Ubuntu Linux server. The version of Ubuntu I
used in 12.04 and it is 32bit.
While installing Ubuntu I installed the LAMP so that I already have the required Apache, PHP
and MySQL. It can also be installed easily using tasksel command.
The PHP version I used is 5.3.
Check the modules installed with PHP using the command
$ php –m
This command will list the PHP modules already installed. From this command I found that the
GD Library is missing. To install GD library use the command:
$ apt-get install php5-gd
Note: If you are at root user shell, just run the commands without sudo. Also in this doc I used
pico editor to edit files, you can use any editor you like.
Also we need PHP curl library
$ apt-get install php5-curl
Restart Apache after the installation
$ service apache2 restart
To check details of PHP we can use the following script
$ gedit /var/www/info.php
1
<?php
phpinfo();
?>
Save the script in default apache root directory .i.e /var/www and open in a web-browser.
enter url as http://localhost/info.php
Next we have to install LAME mp3 encoder.
$ apt-get install lame
$ apt-get install gcc
$ sudo apt-get install make
2
Download Libogg
$ wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
Extract the downloaded file
$ tar xzvf libogg-1.3.0.tar.gz
Now we are going to compile the libogg, go to the libogg-1.3.0 directory
$ cd libogg-1.3.0
$ ./configure && make && make install
Download Libvorbis and compile it
$ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
$ tar xzvf libvorbis-1.3.3.tar.gz
$ cd libvorbis-1.3.3
$ ./configure
$ ./configure && make && make install
Install Mencoder and also Mplayer
$ apt-get install mencoder
Install FFMpeg
$ apt-get install ffmpeg
3
Install Flvtool2
$ apt-get install flvtool2
Open PHP configuration file /etc/php5/apache2/php.ini and set the
following:
$ gedit /etc/php5/apache2/php.ini
open_basedir =
upload_max_filesize = 100M
post_max_size = 100M
(Note: If you want to upload files larger than 100M set it accordingly)
max_execution_time = 1500
session.gc_maxlifetime = 14000
safe_mode = Off
enable_dl = On
Restart apache to load the changes.
$ service apache2 restart
Check the PHP extensions directory
root@localhost:/var/www$ php -i | grep extension_dir
extension_dir => /usr/lib/php5/20090626+lfs => /usr/lib/php5/20090626
+lfs
My PHP extensions directory is /usr/lib/php5/20090626+lfs , go to this directory
$ cd /usr/lib/php5/20090626+lfs
4
Check is there any phpshield loader
root@localhost:/usr/lib/php5/20090626+lfs$ ls
curl.so gd.so mysqli.so mysql.so pdo_mysql.so pdo.so
Download the PHPShield loader from the link provided in
http://wiki.phpmotion.com/PHPShield53
root@localhost:/usr/lib/php5/20090626+lfs$ wget
http://downloads.phpmotion.com/phpshield-loaders/linux/i386/ixed.5.3
Now we have to add this new extension to PHP configuration file
$ cd /etc/php5/conf.d/
Create a new file ixed.5.3.ini
/etc/php5/conf.d/$ gedit ixed.5.3.ini
Add the line extension=ixed.5.3 to the new file and save it.
Restart Apache.
$ service apache2 restart
Download PHPMotion and extract it.
$ unzip phpmotion.zip
5
Copy Phpmotion to the Apache web server. In this example, I will deploy PHPMotion to the
default root folder of Apache.
$cd phpmotion
$ cp .htaccess /var/www/
$ cp -rf * /var/www/
file is present in the PHPMotion root folder. i.e. in my case in /var/www folder.
We have to change the permission of the cgi-bin folder of phpmotion application to 755
$ cd /var/www
$ chmod -R 755 ./cgi-bin
$ /var/www$ cd /var/www
/ chmod -R 777 addons
/ chmod -R 777 uploads
/ chmod -R 777 classes
/ chmod -R 777 logs
/ chmod -R 777 setup
/ chmod -R 777 pictures
/ chmod -R 777 temp
Now we have to configure database connection to MySQL server. Connect to MySQL server and
create the database and user.
mysql> create database phpmotion;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on phpmotion.* to 'phpmotion'@'localhost'
6
identified by 'passw0rd';
Query OK, 0 rows affected (0.00 sec)
Our Requirement is Fully Completed
Now we will setup PhpMotion on Server......
Open Browser and add url http://localhost/setup/
click Continue
7
Click Continue to Proceed
8
Continue to Proceed
Enter Required Fields as it is Shown below
9
And click to Continue
Now Enter Require Fields
10
Our setup is complete, remove the setup folder from PHPMotion root directory and click
Login to Siteadmin to administer PHPMotion.
11
Installation is done, I can get the admin console:
Enter user and Password that was Entered during Setup
12
But for proper functioning of this application we have to do some additional configurations.
Right now if we go to links like Video, Audios etc. we will get URL not found error
We have to change Apache config file to fix these issues
13
Open Apache config file /etc/apache2/sites-available/default and edit. My default file after
editing looks as follows:
$gedit /etc/apache2/sites-available/default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options Indexes FollowSymLinks Includes ExecCGI
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
14
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
save and restart Apache
Now we will configure RewriteEngine
$:/var/www$ apachectl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_prefork_module (static)
15
http_module (static)
so_module (static)alias_module (shared)auth_basic_module (shared)authn_file_module (shared)authz_default_module (shared)authz_groupfile_module (shared)authz_host_module (shared)authz_user_module (shared)autoindex_module (shared)cgi_module (shared)deflate_module (shared)dir_module (shared)env_module (shared)mime_module (shared)negotiation_module (shared)php5_module (shared)reqtimeout_module (shared)setenvif_module (shared)status_module (shared)If in your Case Rewrite module is not loaded, you have to enable rewritemodule$:/var/www$ a2enmod rewrite16Enabling module rewrite.To activate the new configuration, you need to run:$:/var/www$ sudo service apache2 restartNow check whether rewrite module has been loaded or not$:/var/www$ apachectl -t -D DUMP_MODULESLoaded Modules:core_module (static)log_config_module (static)logio_module (static)mpm_prefork_module (static)http_module (static)so_module (static)alias_module (shared)auth_basic_module (shared)authn_file_module (shared)authz_default_module (shared)authz_groupfile_module (shared)authz_host_module (shared)authz_user_module (shared)autoindex_module (shared)cgi_module (shared)deflate_module (shared)dir_module (shared)17env_module (shared)mime_module (shared)negotiation_module (shared)php5_module (shared)reqtimeout_module (shared)rewrite_module (shared)setenvif_module (shared) %you can see the rewrite module%status_module (shared)Now all the links of PHPMotion site are working fine :) .Captcha Error for new userAlso I found one issue, in the new user registration page, the captcha image is not gettingdisplayed and new users unable to register to the site.18Open the file captcha.php located inside includes directory of PHPMotion root directory, i.e. inmy case /var/www/includes/captcha.php$ gedit /var/www/includes/captcha.phpChange the var $font = 'DoradoHeadline.ttf'; to var $font ='./DoradoHeadline.ttf';Save this file and and check again. This will resolve the issue.19That's all we have to do. Relax and enjoy your PHPMotion installation.20