myRepono - Website & mySQL Database Backup Service
WordPress FAQ Blog Affiliates Contact Log-In

Frequently Asked Questions

FAQ >> API Configuration & Customisation (v2.2, v2.3)

Note

Note, most users do not need to read this article and customise the API. These settings are for advanced configuration and customisation and are primarily intended for dedicated server, VPS and cloud hosting users who would like to increase the backup packet size or enable 256-Bit AES encryption.


This documentation applies to versions 2.2 and 2.3 of the API, you can determine your API version via the 'Domains' -> 'API' section of your account.
 
The myRepono API includes a number of customisable configuration variables which enable you to change how the API processes your backups.
 
To change these configuration variables, firstly download the 'myrepono.php' API script from your website (or via the 'Domains' -> 'API' section of your account) and open it in a text editor such as TextPad, UltraEdit or WordPad (do not use NotePad).
 
At the top of the myRepono API script (just below the license statement) you will see the following variables:
 
// CONFIGURATION
 
$client_key = "MYREPONOAPIKEY";
$client_password = "MYREPONOAPIPASSWORD";
 
$api_packet_filesize = "7";
$api_packet_files = "250";
$api_mysql_packet_size = "1";
$api_max_file_filesize = "7";
$api_max_files_per_process = "250";
$api_max_http_filesize = "64";
$api_timeout = "60";
$api_memory = "256";
 
$api_create_htaccess = "0";
$api_create_data_htaccess = "1";
$api_mcrypt_rijndael = "0";
$api_myrepono_https = "0";
$api_recursive_filesize = "1";
$api_ip_authenticate = "1";
 
$api_allow_exec = "1";
$api_mysqldump = "1";
$api_mysqldump_path = "mysqldump";
$api_csplit = "1";
$api_csplit_path = "csplit";
$api_split = "1";
$api_split_path = "split";
$api_allow_mysqli = "1";
$api_allow_chmod = "1";
$api_force_curl = "0";
 
$api_data_directory = "data";
 
$enable_debug_log = "0";
$enable_error_log = "1";
$enable_peak_memory_log = "0";
 
// END CONFIGURATION

 
These variables are used as follows:
 
$client_key
Your myRepono API Secret Key as provided in the 'API' section for your domain. This value will be automatically set when downloading the API.
 
$client_password
Your myRepono API Password as provided in the 'API' section for your domain. This value will be automatically set when downloading the API.
 
$api_packet_filesize
Controls the maximum filesize for your backup packets. Be careful when increasing this value, by default the value is set at 7MB for high compatibility, 10MB is the optimal packet size for most servers since a larger filesize can cause the ZIP archive, compression or encryption processes to fail if the API is unable to complete the processes within the maximum PHP execution time allowed by your server. We recommend experimenting with this value to find what setting works best on your server. The value entered should be the number of megabytes as an integer, e.g. '10' represents 10MB. This setting is used in association with the $api_packet_files value.
 
$api_packet_files
Controls the maximum number of files which can be included in your backup packets. Be careful when increasing this value, by default the value is set at 250 for high compatibility, 250 files is the optimal packet file count for most servers since a larger number of files can cause the ZIP archive, compression or encryption processes to fail if the API is unable to complete the processes within the maximum PHP execution time allowed by your server. We recommend experimenting with this value to find what setting works best on your server. This setting is used in association with the $api_packet_filesize value.
 
$api_mysql_packet_size
Controls the maximum filesize for your backup SQL files, if a SQL file exceeds this size it will be split into multiple files. Be careful when increasing this value, by default the value is set at 1MB for high compatibility, 5MB is the optimal packet size for most servers since a larger filesize can cause the ZIP archive, compression or encryption processes to fail if the API is unable to complete the processes within the maximum PHP execution time allowed by your server. We recommend experimenting with this value to find what setting works best on your server. The value entered should be the number of megabytes as an integer, e.g. '10' represents 10MB. This setting is used in association with the $api_packet_files value.
 
$api_max_file_filesize
Controls the maximum individual filesize which can be backed up without being split into smaller packets for individual transfer. Files which do not meet the $api_packet_filesize limitation are not archived or compressed, but they are split into multiple packets which are individually encrypted and transferred (and then recompiled into a single encrypted file by our system). This setting limits the maximum filesize which may be transferred without being split. We recommend experimenting with this value to find what setting works best on your server. The value entered should be the number of megabytes as an integer, e.g. '10' represents 10 MB.
 
$api_max_files_per_process
When indexing your directories and files to be backed up, the API will split the indexing into multiple processes to reduce the load on your server, and to avoid any PHP timeout limitations. By default this value is set to '500' (files/directories per process) for high compatibility, however if your server supports a high PHP timeout then this value can be set to '10000', or higher.
 
$api_max_http_filesize
Controls the maximum filesize which can be transferred before switching to the FTP transfer method (which requires you 'Configure FTP Backups' via the 'API' section for your domain). By default this value is set to '64' which means all files which are larger than 64MB will be transferred via FTP, files which are smaller than 64MB will be transferred via HTTP using the API's default methods. We recommend experimenting with this value to find what setting works best on your server. By default this value is set to '64' (64MB) for high compatibility, however if your server supports a high PHP timeout then this value can be set to '528', or higher.
 
$api_timeout
If PHP is not running with safe mode enabled then you can adjust the PHP timeout value using this variable. The value entered should be the number of minutes as an integer, e.g. '10' represents 10 minutes, or 600 seconds. The maximum timeout the API will allow is 180 minutes/3 hours. The API is designed to run each process in less than 30 seconds, however in some cases the API may need to wait for longer periods of time, for example whilst waiting for a large mysqldump SQL backup. This setting also attempts to adjust PHP's 'mysql.connect_timeout' and 'default_socket_timeout' settings to avoid timeouts associated with this settings.
 
$api_memory
Controls the API's memory limit if PHP allows adjustment to the default PHP memory limit. The value entered should be the number of megabytes (MB) as an integer, e.g. '64' represents 64MB. The API is designed to run each process using a minimal amount of memory, however in some cases the API may need a higher memory limit, for example if the above configuration variables are increased.
 
$api_create_htaccess
If enabled (set to 1) the API will create an Apache .htaccess file within the myRepono API directory. This .htaccess file adds an additional IP authentication stage for extended security. This option should be disabled (set to 0) if you are not using a server which is running the Apache Web Server software. If the myRepono API directory returns an internal server error, disable this setting and remove the .htaccess file created in the directory.
 
$api_create_data_htaccess
If enabled (set to 1) the API will create an Apache .htaccess file within the myRepono API data directory. This .htaccess file will block any web access to your API data directory for extended security. This option should be disabled (set to 0) if you are not using a server which is running the Apache Web Server software, and alternate methods should be used to secure the API data directory. If the myRepono API data directory returns an internal server error, disable this setting and remove the .htaccess file created in the directory.
 
$api_mcrypt_rijndael
If enabled (set to 1) the API will use PHP's mcrypt function to encrypt the backup packets using Rijndael 256-Bit encryption. This encryption is extremely secure but the mcrypt function is less efficient that the API's default encryption method. If this function is enabled, it takes approximately 3 times as long to create your backup packets, therefore if your PHP script timeout value is too low (under 60 seconds) the API will be unable to encrypt the backup packets quickly enough, therefore you may need to reduce the $api_packet_filesize, $api_packet_files and $api_max_file_filesize values. This feature requires you have the PHP mcrypt library installed, if the option is enabled when mcrypt is not available then the default encryption will be used.
 
$api_myrepono_https
As part of the backup authentication process the myRepono Backup API makes connections to myRepono.com. If the $api_myrepono_https value is set to '1' these connections will always use the HTTPS protocol (SSL) to ensure all data transfer is secure, however not all servers support HTTPS connections. By default the $api_myrepono_https value is set to '0' to disable usage of the HTTPS protocol (SSL) and to only use the standard HTTP protocol for all connections, this ensures a high-level of compatibility however we recommend that the option is set to '1' whenever possible.
 
$api_recursive_filesize
If enabled (set to 1) the API will use recursive directory filesize calculations when providing directory indexes for the purpose of selecting files/directories for backup, this means the API calculates the total filesize for all files and directories within each directory to provide the user with valid filesize calculations. If disabled (set to 0) then all directory sizes will be reported as '0', this significantly improves the API's performance when providing directory indexes, and will resolve timeout issues when indexing very large file structures.
 
$api_ip_authenticate
If enabled (set to 1) the API will check the visitor's IP address used to access the API matches one listed in the approved IP address list provided by myRepono.com. If disabled (set to 0) the API will not check the visitor's IP address, this option should only be disabled if your server is unable to detect the visitor's IP address correctly, for example if you use a proxy server or firewall which does not forward the IP address.
 
$api_allow_exec
If enabled (set to 1) the API may use PHP's exec() function to utilise command-line tools and functions, these tools are only used to improve efficiency and reliability, or to avoid compatibility issues. The command-line tools and functions which are used are mysqldump, split, csplit, stat, mv/move and cp/copy. mysqldump is used for generating backups of large database tables, split and csplit are used for splitting large files into smaller packets only when PHP is unable to do so (if the file is over 2GB and on a 32-Bit system), stat is used for filesize detection when PHP is unable to do so (if the file is over 2GB and on a 32-Bit system), and the mv/move and cp/copy commands are only used as a fail-over if PHP is unable to move or copy a file. If disabled (set to 0), all usage of the exec() function is restricted irrelevant of your $api_mysqldump, $api_csplit and $api_split settings.
 
$api_mysqldump
If enabled (set to 1) the API will use the command-line tool 'mysqldump' to generate mySQL database backups. The 'mysqldump' tool is more efficient than the default mySQL backup method and can be used to backup much larger databases, however 'mysqldump' is not supported/offered by all servers. If your server supports 'mysqldump' then you can enable this feature, the $api_mysqldump_path value is used to define the server's path to 'mysqldump'. When enabled the API will attempt to auto-detect if 'mysqldump' is supported.
 
$api_mysqldump_path
The value represents the path to the command-line tool 'mysqldump', if the $api_mysqldump option is enabled (set to 1) then the $api_mysqldump_path value is used when calling the 'mysqldump' tool. Setting this to 'mysqldump' will usually be sufficient, however you may need to set a full path such as: /usr/bin/mysqldump
 
$api_csplit
If enabled (set to 1) the API will use the command-line tool 'csplit' to split backup files into smaller files. The API is not able to encrypt large files on systems with limited resources, therefore large files must be split into smaller files to be processed, the files are then automatically re-compiled by our system. The 'csplit' tool is used to split files which PHP is unable to access, this usually only applies to files which are over 2GB and on a 32-Bit system. When enabled the API will attempt to auto-detect if 'csplit' is supported. Usually only 'csplit' or 'split' will be used, both are supported for improved compatibility.
 
$api_csplit_path
The value represents the path to the command-line tool 'csplit', if the $api_csplit option is enabled (set to 1) then the $api_csplit_path value is used when calling the 'csplit' tool. Setting this to 'csplit' will usually be sufficient, however you may need to set a full path such as: /usr/bin/csplit
 
$api_split
If enabled (set to 1) the API will use the command-line tool 'split' to split backup files into smaller files. The API is not able to encrypt large files on systems with limited resources, therefore large files must be split into smaller files to be processed, the files are then automatically re-compiled by our system. The 'split' tool is used to split files which PHP is unable to access, this usually only applies to files which are over 2GB and on a 32-Bit system. When enabled the API will attempt to auto-detect if 'split' is supported. Usually only 'csplit' or 'split' will be used, both are supported for improved compatibility.
 
$api_split_path
The value represents the path to the command-line tool 'split', if the $api_split option is enabled (set to 1) then the $api_split_path value is used when calling the 'split' tool. Setting this to 'split' will usually be sufficient, however you may need to set a full path such as: /usr/bin/split
 
$api_allow_mysqli
If enabled (set to 1) the API will use PHP's mySQLi extension when connecting to mySQL databases. If this option is disabled (set to 0), or if the mySQLi extension is not supported then PHP's mySQL extension will be used. PHP's mySQL extension has been depreciated and will be removed in the future, therefore usage of mySQLi is recommend whenever supported.
 
$api_allow_chmod
If enabled (set to 1) the API is permitted to use PHP's chmod() function in order to change the permissions/CHMOD of files. When processing backups, only the permissions on files created by the API will be changed if the API is unable to access a file (for example, when created by a command-line tool such as 'mysqldump'). When processing restorations, the API may change permissions on directories and files in order to restore files, in all cases the API will revert the permissions back to those previously set. This feature can be disabled to prevent PHP warnings on systems where the chmod() function is restricted, since such warnings can cause large error logs.
 
$api_force_curl
If enabled (set to 1) the API will use the PHP CURL extension for all HTTP/HTTPS requests. By default the API will use the 'file_get_contents()' PHP function and will fail-over to the CURL extension if the function fails, under certain circumstances this fail-over will not work and the $api_force_curl variable must be set to '1'.
 
$api_data_directory
This value represents the name of the API data directory, the API data directory is a directory (by default called 'data') which is created in your main API directory and is used to store all files created by the API. Alternatively a full system path to an API data directory outside of the main API directory can be specified. When specifying a full system path a relative path can not be used, and the path must not end with a slash (e.g. /home/username/data). All web access can be restricted (see $api_create_data_htaccess option above). The API data directory must be writable, meaning at a minimum PHP is permitted to create files within that directory, this is usually accomplished by setting the directory permissions (CHMOD) to 777 or 666.
 
$enable_debug_log
If enabled (set to 1) the API will generate debug log files for troubleshooting and debugging purposes. We recommend this is only enabled by experienced PHP developers or under the advice of support, if enabled please ensure you regularly remove the debug logs from your API data directory as these will not be automatically removed and can be large.
 
$enable_error_log
If enabled (set to 1) the API will generate a PHP error log file for troubleshooting and debugging purposes (if any errors are generated). We recommend this is only enabled by experienced PHP developers or under the advice of support. When enabled an 'error.log' file will be created in your API directory, this file will be automatically removed by the API on a periodic basis. Under certain PHP configurations the API may also generate an 'error_log' file in the API directory, this will also be automatically removed by the API on a periodic basis.
 
$enable_peak_memory_log
If enabled (set to 1) the API will generate a peak memory usage log file which indicates the maximum amount of memory the API has used (at it's absolute peak). We recommend this is only enabled by experienced PHP developers, if enabled a 'memory.log' file will be created in your API data directory, this file contains a string in the format 'MEMORY|DATE' where 'MEMORY' is the peak memory usage is bytes, and 'DATE' is the Unix 'epoch' timestamp for the peak.
 
When you are done customising your API, simply upload it to your web site.
 
If you require any assistance customising the API or have any questions regarding it's configuration, please don't hesitate to contact us.

Did you find this page helpful?   Yes Yes No No

Search FAQ

 

Related Articles

Popular Questions

Tag Cloud

settings   domain   configuration   account   payment   location   api   connect   php   restore   download   url   archive   mysqldump   file   profile   wordpress   email   packets   database   restoration   log   backup   mysql   servers   server   remove   directory   packet   password