Detailed and Easy Steps to Install VidiScript

Install Vidiscript
This article will help you to install VidiScript and fix the issues while installing the VidiScript.

VidiScript is one of the powerful FREE open source video sharing or video streaming community scripts available online today! I recently had a chance to install VidiScript for one of my clients and faced many code issues while installing it. I thought to share the steps that I followed to install it.

VidiScript application is built for older PHP versions, and new PHP versions ( 5.3.x, 5.4.x, 5.5.x, etc.) seem to have issues. I manage to fix all of these code issues, and you can find the complete installation steps below.

 

1) First thing you have to do is, install the requirements. The requirement list is given below.

Vidiscript requires the following server setup:

  • PHP 4.3 or higher
  • GD Graphics library 2
  • .htaccess and URL rewrites must be enabled
  • cURL Enabled
  • Latest IonCube loaders
  • Your server must support FFmpeg

Also:

  • FFmpeg (http://ffmpeg.mplayerhq.hu)
  • FFmpeg-PHP (http://ffmpeg-php.sourceforge.net)
  • MEncoder and Mplayer (http://www.mplayerhq.hu)
  • LAME (http://lame.sourceforge.net)

 

Recommended PHP configuration:

  • safe-mode= off
  • open-basedire = (no value)
  • max_input_time = 1000
  • max_execution_time = 1000
  • upload_max_filesize = 200M
  • register_argc_argv = On
  • post_max_size = 200M

 

So, let’s install the requirement. I presume you already have PHP 4.3 or higher, GD, .htaccess, mod_rewrite, Curl, and IonCube loaders ( These are very easy to set up, and if you need steps to install these, please do let me know. ) To install FFMPEG and mention applications, please follow the article- Install FFMPEG on CentOS/Fedora/RHEL : Easy Steps

After completing the steps, please set up the PHP configurations as mentioned. ( type “php -i | grep php.ini” to get the php.ini file location ). If you have other domains in the server, it is not suggested to set the values in the main php.ini. Instead, you can add the values in your domain-specific custom php.ini file.

 

2) Now, we have met all the requirements, and it’s time to Download VidiScript.

While I’m writing this post, the latest version of VidiScript is “1.0.3a”. Download and move the “vidiscript1.0.3a.zip” file to your domains’ document root. ( Let me know if you are having trouble finding the document root )

In this case, I’m using a cPanel server, and the domains name is “example.com”, account name is “exam”. So I moved the file to “/home/exam/public_html”. That is my document root.

 

3) Extract the “vidiscript1.0.3a.zip”

unzip vidiscript1.0.3a.zip

That will create the following files.

root@bil[/home/exam/public_html]# ls
./ ../ CHANGES.txt README.txt VidiScript/ vidiscript1.0.3a.zip

 

4) Move all files under “VidiScript” directory to the document root. ( /home/exam/public_html )

mv -f VidiScript/* VidiScript/.* ..

 

5) Go to document root and set the permissions and ownership.

cd /home/exam/public_html

( As I mention here, I’m using a cPanel server, and the owner is “exam”. I don’t have to manually set the ownership in cPanel because cPanel does have a script to correct the ownership of “public_html” – /scripts/chownpublichtmls. If you are using any other servers, please correct the ownership manually. )

/scripts/chownpublichtmls

 

6) Create a MySQL database, user name, and password for our Vidiscript application by following the steps below.

mysql -u -p
mysql> create database exam_data;
mysql> GRANT ALL ON exam_data.* TO exam_usr@localhost IDENTIFIED BY 'Qwe123!@#';
mysql> GRANT ALL PRIVILEGES ON exam_data.* TO exam_usr@localhost IDENTIFIED BY 'Qwe123!@#';
mysql> exit

( Here, I created a database called “exam_data” and a user named “exam_usr” with the password “Qwe123!@#”. Please note that you can create a database and password from the cPanel front end, no need to follow this method. I love to do stuff within the shell, and that’s why I’ll follow this method. )

 

7) Let’s start the installation by accessing “http://example.com/install” in your browser.

The steps are self-explanatory ( Do let me know if you are having any trouble ), and when it asks for DB info, give the server name as “localhost” and the database details that we created in the 6th step. )

Complete the steps, and that will install “VidiScript” under “http://example.com”

That’s it! You have installed VidiScript in your system.

The installation was effortless, right? Now it’s time to fix some code issues.

 

Issues and Fixes.

Issue 1:

After installation, when you try to access the media that you uploaded, you will get the following error.

Fatal error: Call to undefined function session_register() in /home/exam/public_html/includes/play.inc on line 74

This is because function ” session_register()” is deprecated as of PHP 4.1.0 and we can use “$_SESSION” instead. I have checked the play.inc file and found that the ” session_register()” function is defined in two places as shown below.

session_register(pagelink) ;
$_SESSION['pagelink'] = $pagelink ;
session_register(vidid) ;
$_SESSION['vidid'] = $vidid ;

As you can see, both lines do the same function, and developers probably did this to provide support for older PHP versions. If we left “session_register” in the file, we would get a blank page with a fatal error. We are safe to comment on the “session_register” line because “$_SESSION” is also defined in the code.

So, to fix this issue, remove or comment the lines “session_register(pagelink) ;” and “session_register(vidid) ;” from the “play.inc” file.

 

Issue 2:

After fixing the error with “session_register”, I get another error on the same page when accessing the media.

Fatal error: Cannot redeclare date_diff() in /home/exam/public_html/ajaxfunc.php on line 57

This is because “date_diff” is an predeclared PHP function (as of PHP 5.3.x) and here the code is again trying to define the function. I found this function is declared in the files given below.

./includes/showgroup.inc
./includes/usercp.inc
./includes/profile.inc
./includes/usercp.inc
./ajaxfunc.php

An example declaration in “./includes/usercp.inc” file is given below.

function date_diff($str_start, $str_end) {
$defdate = $str_start ;
$str_start = strtotime($str_start) ;
$str_end = strtotime($str_end) ;
$nseconds = $str_end - $str_start ;
$ndays = floor($nseconds / 86400) ;
$nseconds = $nseconds % 86400 ;
$nhours = floor($nseconds / 3600) ;
$nseconds = $nseconds % 3600 ;
$nminutes = floor($nseconds / 60) ;
$nseconds = $nseconds % 60 ;
$retString = "" ;
if ($ndays > 0) {
$retString .= $defdate ;
return "at ".$retString ;
}
if ($nhours > 0) {
$retString .= " ".$nhours." hour" ;
if ($nhours > 1)
$retString .= "s" ;
}
if ($nminutes > 0) {
$retString .= " ".$nminutes." minute" ;
if ($nminutes > 1)
$retString .= "s" ;
}
if (strcmp($retString, "") == 0)
$retString = "< 1 minute" ;
return $retString." ago" ;
}

As I mentioned, we are safe to remove these lines. Remove the declaration from the mention lines, and that will fix the issues.

 

Issue 3:

Unfortunately, I was again getting a Fatal error.

Fatal error: Call to undefined function session_is_registered() in /home/aastvidi/public_html/ajaxfunc.php on line 215

It was the same issue I mention in “Issue 1”. There, it was “session_register()” and here it is “session_is_registered()”. Do the following to fix the issues.

Change the below line in “ajaxfunc.php”

if ((session_is_registered(username)) && ($_SESSION['username'] != "")) {
$loggedIn = 1 ;
}
else {
$loggedIn = "" ;
}

To the code given below.

if ($_SESSION['username'] != "") {
$loggedIn = 1 ;
}
else {
$loggedIn = "" ;
}

That will fix all issues with your “VidiScript”!

 

If you are having any other issues. Please comment below, and let’s discuss it.

Share this post

Services to Explore

Stay up to date!

Stay up to date with the Web Hosting, Cloud and Server Management Industry News and Tutorials!

We will send you only the relevant emails, and we respect your privacy. Please review our privacy policy for more info.

Linux Management Services

Focus on your business, and let us take care of your Linux Servers!
From what you are reading, it seems you are interested in Linux and related technologies. If you have a moment to spare, please take a look at our Linux Management Services plan, which might interest you even more!
Linux Management Plan

Value-Added Services

We have services that can help you run a successful business. With us, you don't have to worry about these areas because our experts will take care of it for you.

ServerHealers uses cookies.