How To Install YouPHPTube on Ubuntu Server: A YouTube Clone Script

YouTube is the most popular and giant online video streaming platform. The Youtube is owned by the Google but you can make your own personal YouTube by installing an open source video streaming solution called YouPHPTube. It is just like YouTube and you can say it is a perfect PHP based YouTube clone script. This PHP based video script allows creating a features rich video sharing site platform. You can start your own  Live Video Streaming Business using this streaming platform. It uses NGINX to convert Live Stream into HLS format, making it HTML5/mobile compatible. Using it you can also download and encode videos from other sites like Youtube, Vimeo, etc. and share directly on your website. It provides user based login system and people can use Facebook or Google login to register the YouPHPTube. As it is open source and if you are a developer then you are free to customize it.

The YouPHPTube is not limited to video streaming it also supports Google AdSense which means you can start making money with your own video sharing site.

youtube clone github

Key Features of Open source YouPHPTube: 

  • Live Video Streaming
  • Integrated with functionality that allows you to sync your videos with YouTube and also Upload & Download.
  • Encode multiple formats multimedia files to MP4, WebM and MP3 files.
  • Separate installation of Encoder server is possible
  • Like YouTube User Subscription feature.
  • Videos Statistics option to monitor your videos performance.
  • Allows Google Ads Sense to display advertisements on the videos.
  • Segregate the video on the category basis and organize them.
  • Built-in videos Ads system that allows playing the ads before playing any videos just like Adsense ads on YouTube.
  • Facebook and Google Login.
  • Plugins support to enhance the functionality.
  • Language Translations.
  • User Playlist to organize the videos into groups.
  • Multiple theme options available.
  • Download videos from sites like and a few more sites.

Prerequisite for Installing YouPHPTube

  • Linux based server for setting up Encoder and Live Streamer server
  • PHP 5.3+
  • MySQL 5.0+
  • Apache web server 2.x (with mod_rewrite enabled)

For YouPHPTube Demo: and  Website Link


Best Opensource video sharing CMS

Install and Setup YouPHPTube Open source Video Sharing Platform

Step 1:  Press the Ctril+Alt+T which will run the Terminal on the Ubuntu server. Run the command SU  and enter the root password. For more info see: how to access or set up the root user on Ubuntu.  Once you successfully got the root access in the Ubuntu move to the next step.

how to access the root on ubuntu to install the media server software

Step 2:  If you want to install both encoder and streamer server on the same server machine then run the given command. What will it do? The given below singe command will Install LAMP server, Git, youtube-dl, python, Encoder server, and Streaming Server plus download and save this PHP project from the Github and save it under Var/www/html directory.

sudo apt-get install apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql 
php7.0-curl php7.0-gd php7.0-intl mysql-server mysql-client ffmpeg git 
libimage-exiftool-perl && cd /var/www/html && sudo git clone && cd /var/www/html && 
sudo git clone 
&& sudo apt-get install python && sudo curl -L -o /usr/local/bin/youtube-dl 
&& sudo chmod a+rx /usr/local/bin/youtube-dl

Note: Use the above command if you are planning to install the Encoder and Streamer on the same server. However, if you want to install the Encoder and streamer separately follow the below-given step by step guide.

Installing Encoder and Streamer on different servers

#1.  Steamer Installation

Step 1: First of all, we install the LAMP server and Git by using the following command.

sudo apt-get install apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql 
php7.0-curl php7.0-gd php7.0-intl mysql-server mysql-client git

The LAMP is the Linux Apache MySql PHP server and these are the base requirements to install the YouPHPTube. Whereas the Git is the version control system that keeps track of changes in computer files and coordinating work on those files among multiple people.


Step 2: Now download the YouPHPTube Streamer to the server by using the following command.

cd /var/www/html && sudo git clone

This command will download the YouPHPTube project from the Github and save it in the var/www/html folder.

#2. Encoder installation

Step 1: Like the Streamer, we also need to install the LAMP server and Git to up and run the Encoder server.

sudo apt-get install apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql 
php7.0-curl php7.0-gd php7.0-intl mysql-server mysql-client git

Step 2:  Install the FFmpeg. The FFmpeg is the free software used to handle multimedia data. It includes libavcodec, an audio/video codec library, libavformat (Lavf), an audio/video container mux and demux library, and the ffmpeg command line program for transcoding multimedia files.

sudo apt-get install ffmpeg git libimage-exiftool-perl

Step 3:  After above setup, its time to download the YouPHPTube encoder files from Github using the command:

cd /var/www/html && sudo git clone


Everything is now ready, you can connect the encoder to the streamer server by the option given in the YouPHPTube dashboard. Right now you can just upload and play the of YouPHPTube but if you want to add one additional feature that allows downloading videos from YouTube, Vimeo and couple of other websites directly to your YouPHPTube website, you need to install the youtube-dl.

Step 4: As the youtube-dl depends on the Python, first we install it.

sudo apt-get install python

Step 5:  In this step, we will download the youtube-dl file and transfer it to the bin folder using the curl command, if you don’t have the curl you can use the weget.

sudo curl -L -o 
/usr/local/bin/youtube-dl && sudo chmod a+rx /usr/local/bin/youtube-dl


sudo wget -O 
/usr/local/bin/youtube-dl && sudo chmod a+rx /usr/local/bin/youtube-dl

Configure the YouPHPTube

After installing the YouPHPTube by using one of the above-given methods. It’s time to access and configure the Youtube alternative opensource video streaming platform called YouPHPTube.

Step 1: To use the YouPHPTube, enter your domain URL  following the folder name YouPHPTube. If you are using it locally then type:

Once you open the URL you will get an error message: “Error. Oops, you’ve have encountered an error“.

Also, the solution of this error is given on the screen, we will let you go through them.

YouPHPTube encountered an error


The error you are getting at this stage is that the Apache doesn’t have the access to read the directory YouPHPTube reside inside the /var/www/html.

To give the access run the command:

 sudo nano/etc/apache2/apache.conf

After running the above command to edit the Apache config file you will see the follwoing code

<Directory /var/www/>

          Options Indexes FollowSymLinks

          AllowOverride None

         Require all granted


Now change the AllowOverride None to AllowOverride All.

video sharing script php free download

After changing, editing and saving the above file, run the following commands:

sudo a2enmod rewrite

service apache2 restart


Step 2:  When you successfully rectify the above problem then refresh the browser, this time you will see that the YouPHPTube is asking for a couple of permissions.

To give permission just click on the details link under each required permission and it shows the commands you need to follow. For example, the first permission it asking us is to give the writable permission to videos directory. When we clicked on the details link it provides the following commands:

sudo mkdir /var/www/html/YouPHPTube/videos

sudo chmod -R 777 /var/www/html/YouPHPTube/videos

The first command is used to create videos directory under the YouPHPTUbe and the second one is for giving the R/W permission


Step 3:  Once you have set all the permissions, refresh the browser and assign the email ID, database password (given at the time of LAMP installation) and admin password.

Step 4: Click on Submit and log in using Username: admin and the password you have given in the above step.

Step 5: Finally you have installed the YouPHPTube successfully. Now upload your videos for sharing. 




Also See: StreamTube – A Best Paid YouTube Clone Script for building a video sharing website

If you have any questions or stuck somewhere just comment and we will reply as soon as possible.


14 thoughts on “How To Install YouPHPTube on Ubuntu Server: A YouTube Clone Script”

  1. Do you know anyone who has tried YouPhpTube? Is it exactly like YouTube? Can content creators monetize their videos and channel and get paid for doing so? Can you provide links to websites using YouPhpTube. Thanks!

    • Sorry, there are many people those are using the YouPHPTube but frankly, we don’t know them personally. As far the monetization is a concern, the YouPHPTube supports the Google Adsense and also the video ads of the third party just like Google add a sense

  2. I have same issue…

    Not Found

    The requested URL /YouPHPTube/user was not found on this server.
    Apache/2.4.18 (Ubuntu) Server at Port 80

    Please help to fix the issue

    • how to upload videos on PHP youtube

      Login to YouTubePHP backend and click on the Video camera icon given on the right top side of the screen and select one option which you would like to prefer to upload your videos. Please see the above screenshot for better understanding.

  3. Please how do i do this with Cpanel….my ubuntu doesn’t want to install….so i prefer using Cpanel.. Please help

    • Simply upload the YoutubePHP downloaded zipped file to your hosting using file manager of Cpanel and then extract that. Create a database from Cpanel for YouTube PHP. In browser point your domain to YoutubePHP folder and then assign database and create username + password. It is almost the same as any other PHP web application installation.

  4. Thanks for the writeup, working well in my lan.
    Does anyone have this working behind an nginx reverse proxy they could share their config?
    I am getting the “Parts of this page are not secure” in browsers on wan side

  5. Good stuff. I haven’t tried it but look great.
    Question though. Whats the architecture ? Does it have a RESTful API?

  6. After executing sudo rm /var/www/YouPHPTube/upload/install/ -r
    the home page is blank

    Am is missing smething.
    server: ubuntu 18.04LTS
    web server: apache

  7. After the installation, I get the following message?
    Please configure your webSiteRootPath

    Any ideas why?


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.