FAQ :: Common questions/answers related to troubleshooting hardware/software issues

(I will modify and add to this list as needed and as my time permits!)
Q. I opened index.php and see a blank page. What should I do?
A. First, turn on error reporting in index.php by editing the following line (at the very top of the file) like so:

PHP Code:
ini_set('display_errors',1); 
This can also be accomplished with:

PHP Code:
error_reporting(E_ALL); 
Both commands will enable the output of PHP errors to the browser.

Also, check your Apache error log for PHP errors and warnings.

If you see a PHP error or warning that you don't understand, please copy and paste the error into Google and behold the plethora of other people who have experienced -- and overcome -- similar errors. Leverage Google to your advantage in this case, and benefit from the experiences of others who have had the same problem.

Q. I opened index.php and see something like: "Parse error: syntax error, unexpected T_FUNCTION in /home/user/public_html/index.php on line...". What should I do?
A. This is generally an indication that you do not have at least PHP 5.3 installed. Anonymous functions usually cause this error, and they were not introduced until PHP 5.3. You need to install PHP 5.3+ to eliminate this error.

Q. I opened index.php and see the following message: "This domain is not authorized to access this software!". What should I do?
A. Open "lib/Config.php" and edit the $_authorizedDomains array to include all domain names (and subdomains!) that are allowed to access/display the software. ("www" IS a subdomain! If you want "www.yoursite.com" as well as "yoursite.com" to work, then you must include both!) For example:

PHP Code:
public static $_authorizedDomains = array(            
   
// List of domain (and subdomain!) names authorized to run this software. Do NOT prepend domains with 'http://' or 'https://'!!            
   // "www" IS a subdomain! If you want "www.yoursite.com" as well as "yoursite.com" to work, then you must include both below!            
   // Leave this array empty to allow all domain names to access the software. (NOT RECOMMENDED!!)            
   
'localhost',
   
'yourconversionsite.com',
   
'www.yourconversionsite.com',
   
'anothersite.com',
   
'www.anothersite.com',
   
'208.67.222.222'
); 
Leaving this array empty will allow ALL domains to access your software. (NOT RECOMMENDED!!)

Q. When I enter a URL and click the "Convert" button, the page reloads and I see a bunch of strange characters and symbols filling up the screen. Why is this?
A. Please ensure that your 'videos' directory is chmod to 0777 permissions. The script is trying to send the video download to the 'videos' directory, but adequate permissions are not set. So the raw, downloaded data has nowhere to go and is ultimately output to the screen.

Q. When I enter a URL and click the "Convert" button, the page reloads, shows me a "Download" progress bar, and nothing happens and/or I see the message "Error downloading remote file!" (or "Error downloading video!"). Why is this?
A. First, have you downloaded at least one site module here? One module is FREE with your Envato/CodeCanyon purchase code. (You may choose any module from the available site mods.)

Ensure that you have installed recent versions of both cURL and the PHP cURL extension.

Verify that the _TEMPVIDDIR constant in "lib/Config.php" is the correct path to your 'videos' directory.

If you have moved the 'videos' directory to outside of the web root, then you will have to use an absolute path instead of a relative path.

Verify that software.xml exists in your software's root directory, and that the file is chmod to 0777 permissions. Also, ensure that your software's root directory permissions allow programmatic modification of software.xml. If software.xml exists, try deleting the file and allowing it to automatically regenerate.

Check the contents of your 'videos' directory. Are there video files in the directory? If so, are the video files playable? Are the videos fully downloaded? Are the videos 0 kb in length?

Try executing a simple PHP cURL request to the video hosting site's video page, and return the contents of the page to the screen. For example, place the following code in a new file, replacing "{video page URL}" with a valid, supported video page URL:

PHP Code:
<?php 
// create a new cURL resource 
$ch curl_init();  

// set URL and other appropriate options 
curl_setopt($chCURLOPT_URL"{video page URL}"); 
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_FOLLOWLOCATION1); 

// grab URL and pass it to the browser 
curl_exec($ch);

// print out any cURL errors as well as HTTP response information
echo 'Curl error: (' curl_errno($ch) . ') ' curl_error($ch) . '<br>';
print_r(curl_getinfo($ch));  

// close cURL resource, and free up system resources 
curl_close($ch); 
?>
Save the file, upload it to your server, and open it in a browser. Do you see the HTML page located at that URL? If the video is blocked in your server's country, then this will be indicated in the screen's output. A blank page or CAPTCHA screen could indicate that your IP has either been temporarily banned or flagged (via the CAPTCHA) for exceeding video pull quota limits. It could also mean that your server is having networking issues.

Ensure that the PHP "safe_mode" directive is set to "Off" and the PHP "open_basedir" directive is set to no value or "". Both directives can be modified in your server's php.ini file, PHP's main configuration file on your server.

Finally, check your Apache error log for PHP errors and warnings.

Q. Videos are downloaded and converted, but I never see the download progress bar (only the conversion progress bar appears). How come?
A. This could be an indication of a networking problem on your server (relating to the configuration of network card software on your server). Contact your hosting provider to see if there is anything that they can do on their end.

This might be a cURL, PHP cURL extension, or PHP output buffering issue. Verify that cURL, PHP, and the PHP cURL extension are installed and configured correctly. Check the output buffering directives in your server's php.ini.

Your server might have a very fast download speed. If the speed is fast enough, consistently, it is possible that the download progress bar is absent because it never has a chance to clear the output buffer before the download completes.

If you are running cPanel, Plesk, Virtualmin, or a similar hosting control panel software, check to see if any of the settings in your control panel are conflicting with the download progress bar. In particular, via your control panel or otherwise, try configuring PHP to run as an Apache module instead of via a CGI wrapper (or vice versa?). Often, adjusting this setting will cause the download progress bar to start working.

If you are using Plesk, try disabling Nginx as an Apache/HTTP accelerator and/or reverse proxy server. Plesk appears to install Nginx as a dependency package and has configured it (with Apache and PHP) in such a way that it may interfere with the progress bar. As a last resort, since most Plesk installations are on Debian/Ubuntu systems, you could try an alternate control panel like Webmin/Virtualmin or ISPConfig.

Also, since progress bar performance is dependent on PHP version, ensure that the _PHP_VERSION constant in "lib/Config.php" is set to the correct PHP version number.

Q. The video download completes, the "Conversion" progress bar is shown, and then nothing happens and/or I see the message "Error generating converted file!". What can I do?
A. First, check that the _FFMPEG constant value in "lib/Config.php" points to the correct location of FFmpeg on your server. On Linux, you can locate the FFmpeg binary via the "which ffmpeg" or "type ffmpeg" commands in the command line interface. On Windows and XAMPP/WAMP, the value of _FFMPEG will generally be "ffmpeg.exe".

Ensure that both the 'mp3' and 'logs' directories are chmod to 0777 permissions.

Check to see if videos are actually being downloaded prior to conversion.

Check your 'logs' directory for FFmpeg log files. Are there any log files in the directory? If so, look for errors in a log file that corresponds to a failed conversion.

Does FFmpeg work from the command console? Try running a FFmpeg command directly in the command line interface. Preferably, run a command that is executed by my software during conversions.

Are you running the most recent version of FFmpeg? (Check your version of FFmpeg by typing "ffmpeg" in the command console. If the dates shown in the resulting output are more than 1-2 years old, then you may have an outdated version of FFmpeg.) Also, my software may not work as expected with FFmpeg builds downloaded from the apt-get (or yum, etc.) repositories. Instead, try downloading a recent, static build from here: Index of /static. This tutorial can assist you further with this process.

You may need to set permissions of the FFmpeg binary to 0777, or lower -- if possible, so that my software has permission to access FFmpeg. This especially holds true for people using a static build of FFmpeg.

Have you installed the libmp3lame codec on your server? You can check quickly by executing a command like the following in the console: "ffmpeg -codecs | grep mp3". The word or phrase after "grep" tells FFmpeg how to filter the installed codecs (you can change this search word or phrase as needed). When you enter this command, check for a capital "E" in front of the codec name ("E" signifies that you can encode with this codec). If the "E" is missing, then there is something wrong with the codec installation.

If you have moved the 'mp3' and 'logs' directories to outside of the web root, then you will have to use an absolute path instead of a relative path for the corresponding constant values in "lib/Config.php".

Try using an absolute path for the 'logs' directory in the FFmpeg command located in GenerateMP3() in "lib/VideoConverter.php".

An improperly configured DNS can cause HTTP requests (made from your server to exec_ffmpeg.php) to fail. To test this possibility, save the following code to a file, and then load the file in a web browser:

PHP Code:
<?php

// create a new cURL resource
$ch curl_init();

// set URL and other appropriate options
curl_setopt($chCURLOPT_URL"http://www.your-domain-here.com");
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_FOLLOWLOCATION1);

// grab URL and pass it to the browser
curl_exec($ch);

// print out any cURL errors as well as HTTP response information
echo 'Curl error: (' curl_errno($ch) . ') ' curl_error($ch) . '<br>';
print_r(curl_getinfo($ch));

// close cURL resource, and free up system resources
curl_close($ch);

?>
Now repeat the process, substituting "http://www.your-domain-here.com" with "http://www.google.com" (or any other domain name other than your site's domain name!) this time.

If the above code consistently fails for any reason, in any way, when CURLOPT_URL is set to "http://www.your-domain-here.com", but consistently works when CURLOPT_URL is set to "http://www.google.com" (or any other domain name other than your site's domain name!), then you likely have an issue with your DNS. Evidently, HTTP requests made from your server are able to correctly resolve the DNS of all sites except your own -- indicating an issue with your own DNS configuration. Possible fixes include using another DNS provider, changing nameservers, and/or having a professional configure your DNS for you.

Q. How long are converted files saved on the server?
A. The short answer: Indefinitely. By default, the software does not allow for the periodic removal of converted files. If you need this, you can write a short PHP script that iterates through and removes old, converted files based on the last modified time of each file in the 'mp3' directory, and then run this script as a regular cron job (scheduled task) on your server.

Q. How can I integrate the software into my existing website? Can I run the software inside an HTML <iframe>?
A. The easiest way to integrate the software into an existing site is to load the software's index.php inside an iframe (on your site). The iframe size will need to be large enough to accommodate the software content. You can make the iframe background transparent via HTML/CSS so that it blends in with the rest of your site. Any additional styling of the iframe or iframe contents can be achieved by directly editing the HTML/CSS of the software files. (You may also want to remove the navigation components from the top of the default design/layout.) Finally, be sure to include the following line at the very top of the software's index.php:

PHP Code:
header('X-Frame-Options: SAMEORIGIN'); 
This header ensures that your iframe cannot be embedded on any other domain but your own.

Q. I think a supported video hosting site is blocking or banning my IP address, and/or I am experiencing a CAPTCHA when trying to connect to a video page. What can I do?
A. If you are frequently getting blocked by a supported site, OR you are experiencing a CAPTCHA page, then you can rotate between multiple outgoing IPs for HTTP requests made to that site's servers. (By default, this feature is not included with the software. That said, what follows is a rough guide for its implementation.)

In this case, you need to purchase some additional IP (IPv4) addresses from your hosting provider. (Often your hosting provider will include additional IPs for free with your hosting plan!) Extra IP addresses generally only cost a couple of dollars apiece, and it's reasonable to "start" with 4-5 IPs for the purpose of IP rotation. You can always buy more IPs later and add them to the rotation as needed. That said, the more IPs you have, the better off you will be. In general, the number of additional IPs required for your site is directly proportional to the amount of traffic to your site.

(Note: Do NOT use "proxy" IPs purchased from a dedicated, 3rd-party proxy provider! The intent of IP rotation is not to hide or obscure your server's identity, but merely to change the outgoing IP address. Also, dedicated proxy IPs are much slower than IPs used as outgoing network interfaces, so you will see a marked decrease in speed and performance if you use proxies.)

Next, you need to configure these additional IP addresses so that they can be used as "outgoing network interfaces". Simply put, your server needs to be configured so that it can "bind" to these extra IPs for HTTP requests. The easiest way to accomplish this is to have your hosting provider do this for you. If you must do this yourself, then you can refer to OVH's guide for setting up "Network IP Aliasing" for a number of different Linux distributions (and Windows): http://docs.ovh.ca/en/guides-network-ipaliasing.html.

Once your additional IPs are set up, load the IP addresses into a new database table, and then write some PHP code that cycles through and uses each IP in the table for each new conversion/cURL request. Generally, integrate IPs used as interfaces into your existing PHP cURL requests by adding the following cURL options, e.g.:

PHP Code:
curl_setopt($chCURLOPT_INTERFACE'208.67.222.222');
curl_setopt($chCURLOPT_REFERER'');
curl_setopt($chCURLOPT_IPRESOLVECURL_IPRESOLVE_V4);
curl_setopt($chCURLOPT_SSL_VERIFYHOSTFALSE); 
To ensure that each IP is used equally, increment a 'usage count' field in the database table for each IP address as it's used. So when your code is cycling through IPs in the table, it always finds the IP that has been used the least number of times and uses that IP for the next conversion/cURL request.

If you find that, with IP rotation enabled, you are still experiencing IP bans and/or CAPTCHAs, then that is generally a sign that you need to add more IP addresses to the rotation (to the corresponding database table). You must keep adding IPs until downloads/conversions start working normally.

If you suspect that there is a problem with the IPs themselves, or the IP configuration on your server, then you should first test each additional IP using the following, simple PHP cURL code:

PHP Code:
<?php
// create a new cURL resource
$ch curl_init();

// set URL and other appropriate options
curl_setopt($chCURLOPT_URL"{video page URL}");
curl_setopt($chCURLOPT_HEADER0);
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
curl_setopt($chCURLOPT_REFERER'');
curl_setopt($chCURLOPT_INTERFACE'23.232.234.2');  // Your extra IP goes here!
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
curl_setopt($chCURLOPT_IPRESOLVECURL_IPRESOLVE_V4);
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);

// grab URL and pass it to the browser
curl_exec($ch);

// print out any cURL errors as well as HTTP response information
echo 'Curl error: (' curl_errno($ch) . ') ' curl_error($ch) . '<br>';
print_r(curl_getinfo($ch));

// close cURL resource, and free up system resources
curl_close($ch);
?>
Ensure that you change the CURLOPT_INTERFACE value to your IP address. Then save the code to a .php file and run it on your server. If you see a video but it won't play, you don't see a video, or you get a cURL error and/or curious HTTP response, then there is something wrong with the IP or its configuration as an outgoing network interface on your server.

To address this issue, on some servers, you can try commenting out this line of code, like so:

PHP Code:
//curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); 
You can also try completely disabling IPv6 on your server. Please consult with your hosting company or server admin to do this.

Q. I think a video or group of videos is blocked in my server's country. What can I do?
A. All countries have some blocked videos. All of them. The only way that you could "unblock" all of these videos is to leverage a global proxy network like Tor: https://www.torproject.org/docs/documentation.html.en. In fact, Tor is the only global proxy network that I am aware of at this time, and it is notoriously known for its slow connection speeds.

A more practical approach is to unblock as many videos as you can without spending a lot of extra money, making a lot of extra work for youself, and generally inducing massive, debilitating headaches.

The easiest way to avoid blocked videos is to choose a web server in a country that, generally, has few blocked videos. In my experience, the USA, Canada, and France have the least number of blocked videos. You would do yourself a favor to choose a datacenter located in one of these countries.

Another way to thwart blocked videos is to use dedicated proxy IPs in your HTTP and download requests. In this case, you can buy one or more proxy IPs from a dedicated, 3rd-party proxy service like http://instantproxies.com/billing/aff.php?aff=061. Again, perferably, the proxies should be located in the USA, Canada, or France. Then you integrate the proxy IPs into your PHP cURL requests like so, i.e.:

PHP Code:
curl_setopt($chCURLOPT_PROXY'208.67.222.222');
curl_setopt($chCURLOPT_USERAGENT'');
curl_setopt($chCURLOPT_REFERER'');
curl_setopt($chCURLOPT_SSL_VERIFYPEERFALSE);
curl_setopt($chCURLOPT_SSL_VERIFYHOSTFALSE); 
When using proxies, you should test for a blocked video first by scraping the content of the video page and checking for text that indicates the video is blocked. If the test indicates that a given video is in fact blocked, then you should use a proxy IP. If not, then don't use a proxy IP. The goal is to only use proxy IPs when you need to because, like Tor, using proxies will always be slower than not using proxies.

When choosing proxies, ideally you'll want to do the following:

1) Choose proxies that are geographically very near to your web server. Ideally, the proxy server would be sitting right next to the web server in the same data center.
2) You are the only person using the proxy server, and you are not using it for anything more than proxy requests.
3) Your proxy server is not a virtual server running on a physical server that is hosting other virtual proxy instances (that you don't operate).
4) Spread out your requests to multiple, numerous proxies instead of only having a couple of proxies, for example.
5) The proxy server(s) should be running with modest CPU load averages and comparable network bandwidth and connection speeds (to your web server).

Do NOT use free proxy IPs. You are sharing those proxies with the rest of the world, and they get banned quickly by popular sites.

I have not yet implemented proxy integration with my software. That said, it is on my "To-Do" list, among other things!