backup database on dropbox using API - php

I have used DROPBOX API to upload backup on my dropbox+php...And I'm on the half way
1)I have made local-connection and took backup file in my local
2)Then I have added key,secret(in config.json) and generated access-token(dropbox_sqlbackup.php) in proper place
Now Where I am stuck is:
I am not able to upload the generated backup file of database on my dropbox...
my error message is:
Fatal error: Uncaught exception 'Exception' with message 'The Dropbox SDK uses 64-bit integers, but it looks like we're running on a version of PHP that doesn't support 64-bit integers (PHP_INT_MAX=2147483647). Library: "C:\xampp\htdocs\demo\dropbox-sdk\lib\Dropbox\RequestUtil.php"' in C:\xampp\htdocs\demo\dropbox-sdk\lib\Dropbox\RequestUtil.php:22
now i have tried other answers on stackoverflow to remove "64 bit integer conversion" but not getting what to do??
the demo i have follwed is :
http://www.inboundhorizons.com/use-php-and-dropbox-api-to-automatically-backup-mysql-databases-to-dropbox/
Which is just to get reference...

Finally, I found the solution....
Don't try the demo in your local system,it will not work in local,You only need to upload the code in live and test it..!!
NOTE:In local your backup file will be generated in your folder but it could not be uploaded on dropbox account

Related

`Invalid grant` error when cron runs website backup google drive api script

I am trying to take backup of my website`s files and database and upload it to google drive from my website via Google drive Api.
Followed instructions as per these links - backup files to google drive using php
https://www.matthewhipkin.co.uk/codelib/automatically-backing-up-your-web-server-files-to-googledrive-with-php/ and did the following -
downloaded the backupgoogledrive folder from https://github.com/hippy2094/backuptogoogledrive and uploaded that in my public_html/backup folder and renamed backuptogoogle.php as backup/index.php
I created the client ID, client secret and an authCode and put those in the setting.inc along with my MySQL username, password and database name. $homedir was put as /home/myuser/ and $sitedir was set to public_html/
Then, I ran in SSH - php /home/user/backup/index.php
This ran fine generating a json file and backup for files and database also was found in google drive.
Then, I set up cron job as follows -
5 0 * * 6 /usr/local/bin/php /home/myusername/public_html/backup/index.php
This should run the script at 00:05 on a saturday but it did NOT run or backup to google drive.
After that, I changed the cron to run every 15 minutes. I noticed that the files and database backups are going to home/myuser folder instead of google drive and the error_log in that folder is giving this error every 15 minutes -
Fatal error: Uncaught exception 'Google_AuthException' with message
'Error fetching OAuth2 access token, message: 'invalid_grant'' in
/home/myuser/public_html/backup/google-api-php-client/src/auth/Google_OAuth2.php:115
Stack trace:
#0
/home/myuser/public_html/backup/google-api-php-client/src/Google_Client.php(127):
Google_OAuth2->authenticate(Array, '4/SCxgUoxjnbe_0...')
#1
/home/myuser/public_html/backup/index.php(38):
Google_Client->authenticate('4/SCxgUoxjnbe_0...')
#2 {main} thrown in
/home/myuser/public_html/backup/google-api-php-client/src/auth/Google_OAuth2.php
on line 115`
Please note while registering at Google API at https://console.developers.google.com/apis I selected Other option in the Credentials Page and not Web Application because my aim is only to take backup for my site. Also, when I selected the Web Application option and generated the client ID and secret and tried to generate the authCode via url generated in SSH, it would give an error with the SSH generated url. So, the solutions for invalid grant which are mentioned in other posts do not work for me as I do not get option for setting call back url.
Please tell what I am doing wrong. Why I am able to run the script successfully manually and not via cron ? When I am running the script manually running in SSH. Only problem happens when cron runs.
Thanks in advance.
Found the solutions as follows -
Put in the file index.php this code -
chdir('/home/user/backup');
Then the cron backed - up the file to google drive properly. So, the problem was with the cron path.

PHPseclib crashes while trying to upload via SFTP

I´ve written a tool using PHPseclibs SFTP solution to uplaod various files to different target server. All targetserver are using wingFTP.
Under some conditions the upload fails without giving any debug message or error code.
I could figure out that the error (if it occures) allways occures in the following line of my code:
[...]
if(!$sftp->put($aResult[0]["targetpath"] . $sFilename, EXPORTFOLDER . "/" . $sFilename, NET_SFTP_LOCAL_FILE)){
[...]
Is there any way to see what is happening? There are no error messages or something... can I configure debug/error messages while using PHPseclib somewhere?
In about 95% of all cases the Upload is successfull and it does not only appear on one target server or for one file. Does someone have an idea where the problem could be located?

QuickBooks php XML Responce parsing Error

I am using QuickBooks v3 php sdk 2.1.0.
Running a query (SELECT * FROM SalesReceipts) gives the XML Response but getting NULL value, tried to applying error message and got this error
Class com\intuit\schema\finance\v3\IPPid does not exist.
Any Solutions ???
At Last Found the Solution....
Steps:
Download the fresh sdk
Replace All the files in sdk/Data Folder
Test Your code now!
If error still persist, replace all the files excepts sdk.config and this will fix your issues.

ISSUU: Upload not working - Response Code: 999 Internal server error

I'm trying to upload files via the API (issuu.document.upload). It worked in the past. But on new files I receive always the following response error:
{"rsp":{"_content":{"error":{"code":"999","message":"a66125aeaff42e3a893a985fdc9b659587880484 - Internal server error"}},"stat":"fail"}}
The document also does not show up in "My Publications" (http://issuu.com/home/publications)
There is no API documentation about this error code...
Problem solved (the ISSUU developers fixed it). From the ISSUU support team: "... It seems like there was some problems with our API servers, ..."

Azure for PHP: "ServiceDefinition.rd" does not exist in Service directory "ServiceDefinition.csx"

I am trying to deploy PHP app with Windows Azure Command Line tool for PHP, but unable to make .cspkg and i'm getting this error:
Runtime Exception: 0: Default document “ServiceDefinition.rd” does not exist in Service directory “ServiceDefinition.csx”!
Error: Unexpected Exit
I have following link for guidelines
http://azurephp.interoperabilitybridges.com/articles/deploying-your-first-php-application-with-the-windows-azure-command-line-tools-for-php
The documentation you are using is OLD and had several issues in past so I would suggest using the latest supported way to create PHP application in Windows Azure:
Download new PHP SDK for Windows Azure which is tested with Windows Azure SDK 1.6. You can download the new PHP SDK from the link below:
http://phpazure.codeplex.com/
Follow the documentation as described here:
http://phpazure.codeplex.com/documentation
Try to use –phpRuntime=”C:\Program Files\PHP\v5.3″ instead of –phpRuntime=”C:\Program Files\PHP”.
i had the some error look here may be you find a solution for your problem :
http://marvelley.com/2011/03/03/24-hours-of-windows/

Categories