Support

UNiTE, Remote CLI, eXtract Wizard

#30156 Can not find a writable log path

Posted in ‘UNiTE and Remote CLI’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

PHP version
n/a
Tool
UNiTE
Tool version
n/a

Latest post by nicholas on Thursday, 06 September 2018 01:03 CDT

simun
Hi, I've been trying to use UNiTE to restore a backup copy of a live website to local server with Wamp.

My goal is to be able to restore my local site from a backup.jpa file in a single step, instead of runing kickstarter and go through ANGIE every time, which to my knowledge is possible with UNiTE.

First I'd like to say that I have very little experience using a command line, and your documentation of UNiTE doesn't explain very well how to setup and run UNiTE on command line.
The documentation for creating the xml file is very good though.

From other topics, I figured that the run command for UNiTE is:
php /path/to/file/unit.phar /path/to/file/settings.xml

Next, on windows, Command Promt (cmd) doesn't recognize php as a command out of the box after installing Wamp. For this I found help in this video: https://www.youtube.com/watch?v=neBVQBL_2P0
Similar information would have been nice to have in your documentation for first time setup of UNiTE.

Now for the topic, I've created my xml file and copied it and the unite.phar file into my local site's root directory: "C:\wamp64\www\mysite" where my backup.jpa file also is located.

In Command Promt I first navigate to my C-drive root directory and then execute the following command:
php /wamp64/www/mysite/unite.phar /wamp64/www/mysite/settings.xml


This results in the following:
C:\Users\MyUser>cd\

C:\>php /wamp64/www/mysite/unite.phar /wamp64/www/mysite/settings.xml

Akeeba UNiTE 4.0.1 (2018-03-15)

Copyright ┬®2008-2018 Nicholas K. Dionysopoulos / Akeeba Ltd.

-------------------------------------------------------------------------------------------------------------------------

This program comes with ABSOLUTELY NO WARRANTY. This is Free Software and you are welcome to redistribute it under certain conditions. Use command license for details.

-------------------------------------------------------------------------------------------------------------------------

***********************************************************************

****** ERROR ******

***********************************************************************

An error has occurred while running Akeeba UNiTE. The restoration of the backup has failed. The last error message was:

Can not find a writeable log path. Please supply a writable log path with the --log=<path> command line option.


According to your documentation the log should default to current working directory if not provided?
I did however try to add
--log=/wamp64/www/mysite
at the end of my command, but it still results in the same message

nicholas
Akeeba Staff
Manager
We cannot document how to set up your local machine. You are using Windows + WAMP. Someone else might be using MAMP, XAMPP, their own PHP installation which could be anywhere on the server, or they could be using Linux or macOS. Each one can have hundreds of thousands of different combinations of software and locations.

Regarding your problem, it's pretty obvious that even though you are on Windows the paths you are giving are not in Windows format.

The command line you should have used is:

php C:\wamp64\www\mysite\unite.phar C:\wamp64\www\mysite\settings.xml

ASSUMING that unite.phar, settings.xml and the backup archive are all stored in C:\wamp64\www\mysite.

Also note that the paths in settings.xml MUST be given in Windows format since you're on Windows. If you have any paths like /wamp64/... in your settings.xml file this will NOT work. Windows, unlike literally every other operating system, needs to be given the drive letter explicitly to find a path.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

simun
Hi Nicholas

I wouldn't expect a complete documentation on how to set it up for each case, as you say there are many different combinations of this.
But some general info would help a lot on how to setup UNiTE on windows, Linux, OS X.

Like if using Windows, you have to make sure your cmd is configured to use php and that you have to use the full windows path format including the drive letter and then maybe a sample command for this.

On my test setup I do have the unite.phar, settings.xml and the backup archive all stored in C:\wamp64\www\mysite.

And then running the command
php C:\wamp64\www\mysite\unite.phar C:\wamp64\www\mysite\settings.xml
still gives me the same error message about "Can not find a writeable log path..."

However if add "--log=C:\wamp64\www\mysite" to the command the restoration works. Not sure why it doesn't work without this as I think UNiTE should be able to use it's default path?

I did however get one error message about UNiTE not being able to delete the backup archive after restore.

"Warning: unlink(C:\wamp64\www\mysite\backup.jpa): Permission denied in phar://C:/wamp64/www/mysite/unite.phar/Engine/Step/Extract.php on line 148
Could not delete package C:\wamp64\www\mysite\backup.jpa. You'll have to do it manually."

I do in my xml file have the deletePackage syntax set to 1.

nicholas
Akeeba Staff
Manager
The installation instructions are simple: put the unite.phar in a folder, run it the same way you'd run any PHAR file on your operating system, i.e. run it with PHP. We can't document how to set up PHP on your system.

Explaining how to put the PHP binary in your PATH under various Operating Systems is documenting how that OS works and how PHP installation works in each case. So, basically, you are asking me to do what I told you I cannot do and after you agreed to my reasoning...?

Regarding the errors you get they also fall under "tell me how Windows works". Windows has the concept of ACLs (access control lists). These tell the system which user has which privileges on which files and folders. Your C:\wamp64\www\mysite folder does not have some of the privileges for the user you are running under. If unsure give the Full Control privilege to the Everyone built-in authentication object for both the mysite folder and the backup archive file.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

simun
About the documentation, It sounds to me you are thinking about a more in depth detailed 'How to' explanation that you can't do.
I was thinking more about a short general explanation. For me 3 lines and a sample command to run unite like I mentioned previously would have helped me on the right track from the start.
However if you can't do this, then I guess that's fine as you have otherwise helped me on the right track here :)

And it seems you missed my question about the --log=<path> command. Is it usually a required option?
Or is it specific to to my user case, that UNiTE is not able to run without it?

Regarding my error about unite not being able to delete the backup archive still bothers my.

I'm working on a computer with only one user with administrator privileges. I've tried to give Full Control privileges to all possible user groups: Authenticated Users, SYSTEM, Administrators and Users to the Wamp root folder C:\wamp64 which is then inherited to all subfolders and files. Also tried running cmd as administrator and then run the unite command.

Still UNiTE is not able to delete my backup.jpa archive file?
If I restore the archive file using Kickstart.php then this issue is not present, as it doesn't have any issue deleting the archive file upon clicking "Clean".

nicholas
Akeeba Staff
Manager
But the documentation already gives the command line. Are we talking about something different? Can you explain what you had in mind?

Regarding the log path, it should be automatically set to the directory of the script. If this doesn't happen you can specify it manually. I haven't tried that lately on a Windows computer but I'll do tomorrow as today I'm in the middle of releasing all the things...

Regarding my error about unite not being able to delete the backup archive still bothers my.


This is definitely an access control issue. Last week I was working on Windows and had similar issues. I had to give read and write permissions to the user my web server was running under to have Kickstart delete the backup archive. FYI UNiTE internally uses a copy of Kickstart's engine (restore.php), just like Kickstart itself and Akeeba Backup's integrated restoration. It's always the same code doing the extraction and clean-up to minimize screw-ups.

I am afraid I don't know which user WAMP runs under. I had several issues with WAMP and XAMPP so I'm using my own Apache + PHP installation on my Windows computer. I'm also using IIS which is even more mercurial than the XAMPP and WAMP but I have to support it which is the only reason I am subjecting myself to its torture.

Still UNiTE is not able to delete my backup.jpa archive file?

If I restore the archive file using Kickstart.php then this issue is not present, as it doesn't have any issue deleting the archive file upon clicking "Clean".


This confirms that it's an access control issue. Kickstart runs as the same user as your web server. That user apparently has read and write permissions to the backup archive. When you are running UNiTE from the command line it runs as the user you are currently logged in. This user does not have these permissions, hence deleting the backup archive fails.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

simun
But the documentation already gives the command line. Are we talking about something different? Can you explain what you had in mind?

Yes, but being new to UNiTE I thought that command was for setting up a cron job only as it is the page title. And the sample command provided there didn't initially help my much to run unite in command line. The '/usr/bin/php-cli' is not used in this case and the lead 'php' is not there. And if using windows, a note stating that you have to use the windows specific path format instead of the path format used in the documentation would be nice.

For that specific documentation page, I noticed that the two these two URL at the bottom:
How to schedule tasks on Windows XP
How to schedule tasks on Windows 7 (also works on Vista)
are outdated and does as of today re-direct to 'Help for windows 10'

Now regarding deleting the archive file after restore, I don't know what else I can do solve this using UNiTE.
And even though I set a log path using --log=<path>, UNiTE doesn't create or store any logfile in ~\mysite directory.

What I have done now, is to write a batch file that runs the UNiTE restoration command and then after runs the 'del' command to manually delete the backup.jpa file after the UNiTE command has finished.
:: Restore from backup archive file and then save the result to a logfile.
php C:\wamp64\www\mysite\unite.phar C:\wamp64\www\mysite\settings.xml --log=C:\wamp64\www\mysite\ --verbose > C:\wamp64\www\mysite\UNiTE.log
:: Delete the backup archive file after restoration is complete
del C:\wamp64\www\mysite\backup.jpa
This work just fine.

nicholas
Akeeba Staff
Manager
I am on my Windows computer now and I'm running a restoration using the latest version of UNiTE downloaded from our site. The command line I am using is

php unite.phar test.xml

I do not have any problems running it. I did not have to set up the --log-path at all; the log file was create on the same folder as unite.phar.

What I should note is that I am running my own, custom Apache / PHP / MySQL server per my 2014 blog post (upgraded to use Apache 2.4, MySQL 5.6 and PHP 7.2 since the time I published that post). The server is running under the same account I am using to log into my computer and the folder I am restoring to (c:\apache24\htdocs\restored) is also owned by my user.

So, it looks like the problem is Windows access controls after all.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

simun
Okay, I'm not sure how to grant the necessary access to make it work in my case as giving 'Full Control' to both folder mysite and unite.phar doesn't do it.

I'm using latest version of Wamp 3.1.0 (64 bit). Would it be possible for me to ask you to test it using latest version of Wamp Apache / PHP / MySQL server instead?

If that also works fine for you, I guess I just need to figured what's wrong my windows access control for WampServer not wanting to delete backup archive or create the log file when running UNiTE.

nicholas
Akeeba Staff
Manager
No. We only provide support for our software, not third party software such as WAMP or operating systems such as Windows. The problem lies outside our software. I am closing this ticket since there is nothing productive left to be said about this.

Nicholas K. Dionysopoulos

Lead Developer and Director

πŸ‡¬πŸ‡·Greek: native πŸ‡¬πŸ‡§English: excellent πŸ‡«πŸ‡·French: basic β€’ πŸ• My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!