We provide file conversion API service and one official wrapper for it, written in PHP: https://github.com/convertio/convertio-php.
This article is intended to help you troubleshoot possible issues you may face while using our official PHP API Wrapper on the Linux system, which is the most popular setup for our API.
- As a first step, you should wrap your code into exception handling block, to facilitate the catching of potential exceptions. We have an official PHP example with exceptions catching and you should give it try. Now, when you try to execute the source code, you may see meaningful errors with description. If so, act accordingly.
- We may emphasize some general errors users usually faced with:
- Missing CURL support in the PHP installation. Check this page about curl installation.
To enable curl on Windows you may uncomment
extension=php_curl.dll
string inphp.ini
file (this file should be placed in the directory, wherephp.exe
resides)To enable curl on Linux you may run
sudo yum install php-curl
(for CentOS, RHEL, Fedora) orsudo apt-get install php-curl
(for Ubuntu, Debian)Don't forget to restart your web server (Apache, Nginx or php-fpm):
sudo service apache2 restart
ORsudo service nginx restart
ORsudo service php-fpm restart
- Missing OpenSSL support. This leads to an issue in communicating with HTTPS API endpoint (https://api.converito.co/).
In this case, you may either enable SSL support in PHP or communicate with our API server via insecure HTTP protocol.
To accomplish the latter, please, add 1 line in your code, right after your API initialization line:
$API = new Convertio("_YOUR_API_KEY_")); $API->settings(array('api_protocol' => 'http')); // ADD THIS LINE
- Missing CURL support in the PHP installation. Check this page about curl installation.
- If nothing stated above works, please, take a look into your server error logs, to see is there any specific error appears (Usually these logs placed in /var/log folder of Linux installation).
- If no errors in log files, please, be sure that error logging is enabled in your PHP installation by executing
php --info | grep error
(on your Linux box) and make sure thatdisplay_errors
,display_startup_errors
,log_errors
areOn
; If they aren't - enable them inphp.ini
file (usually/etc/php.ini
) and restart your web server (Apache, Nginx or php-fpm) as stated in paragraph 2.
If nothing works, please, open a support request, give us more information about your setup and some codes snippets for further assistance.