Support

UNiTE, Remote CLI, eXtract Wizard

#3794 Remote Cli - Remote.phar

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, 13 October 2011 14:16 CDT

user48265
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the forum before posting? Yes
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: 1.7.1
PHP version: 5.2
MySQL version: 5.0
Host: (optional, but it helps us help you)
Akeeba eXtract Wizard / Remote Control / SiteDiff version: Remote Cli Script

EXTREMELY IMPORTANT: Please attach the Remote Control and Akeeba Backup log files if you are reporting an Akeeba Remote Control issue, othrewise we can not help you

Description of my issue: When my CRON job triggers, I get the following error via e-mail: Content-type:
text/html



Parse error: syntax error, unexpected ';', expecting '(' in /home/content/90/8442590/html/remote.phar on line 9


nicholas
Akeeba Staff
Manager
Hi!

I think that you are using a version of PHP which does not support PHAR archives. If it is PHP 5.2.x, please ask your host to install and enable the "phar" extension from PECL. If it's PHP 5.3, please ask your host to re-enable processing of PHAR archives in their php.ini.

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!

nicholas
Akeeba Staff
Manager
I also just realised something, right after sending my reply. Why are you using Remote CLI on your host? If you want to schedule a backup using a CRON job you can always use the instructions on our documentation for using the front-end backup mode with wget or curl to achieve the same result. IMHO, it's much easier than getting Remote CLI to work on your host. Remote CLI was designed primarily for use on local machines, connecting to remote hosts in order to trigger a backup and be able to download those backup archives.

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!

user48265
I have tried using the front-end mode with wget and get the following error in my cron report:
--2011-10-12 12:20:01-- http://www.isqccbe.org/index.php?option=com_akeeba&view=backup&key=Scorpio24&format=raw
Resolving www.isqccbe.org... 50.63.43.3
Connecting to www.isqccbe.org|50.63.43.3|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2011-10-12 12:20:01 ERROR 403: Forbidden.

but if I enter the wget sequence directly in a web browser, it completes correctly.

nicholas
Akeeba Staff
Manager
This means that either your host is blocking wget or you have done so in your .htaccess file. First, check your .htaccess file for any user agent blocks you may have added. If it's not your .htaccess, ask your host if they can allow wget to access your site.

You may also want to try curl instead of wget. The instructions we have on the documentation regarding Siteground will actually work on other hosts as well - they use curl instead of wget.

If that still fails, I am perfectly sure that your host is blocking wget and/or curl, in which case you do have to have a chat with your host. There's nothing you will be able to do on your end.

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!

user48265
Here is my .htaccess file:

rewritecond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
rewritecond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
rewritecond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
rewritecond %{QUERY_STRING} GLOBALS(=|\[|\[0-9A-Z]{0,2}) [OR]
rewritecond %{QUERY_STRING} _REQUEST(=|\[|\[0-9A-Z]{0,2})
rewriterule ^(.*)$ index.php [F,L]
rewritecond %{REQUEST_FILENAME} !-f
rewritecond %{REQUEST_FILENAME} !-d
rewritecond %{REQUEST_URI} !^/index.php
rewritecond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
rewriterule (.*) index.php
rewriterule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

nicholas
Akeeba Staff
Manager
It's not something in your .htaccess, which means that it's something in your host's configuration. You have to ask them to allow wget to access your site.

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!

user48265
Well, I think I have finally gotten the .phar extension activated.

Now when running: /web/cgi-bin/php "$HOME/html/remote.phar --action=backup --host=http://www.host.org --secret=SECRET --profile=1"

I get this: Status: 404
Content-type: text/html

No input file specified.


I have also tried running the backup.php script I am attaching and get a 403 error back on it.

nicholas
Akeeba Staff
Manager
You are using the PHP CGI (common gateway interface - used to run web pages) binary which isn't supposed to work. You need to use the PHP CLI (command line interface - used to run command line scripts).

Moreover, the correct command line would look something like this:

cd $HOME/html; /usr/bin/php-cli $HOME/html/remote.phar --action=backup --host=www.myhost.org --secret=SECRET --profile=1

The differences:
- Switching the current directory to the one where remote.phar is located; due to peculiarities in how PHP parses PHAR archives, if you don't do that you might get an error
- Using the php CLI instead of CGI binary at the very start of the command line
- Not using double quotes. If you use double quotes, anything inside the double quotes is considered as a filename, therefore your command line won't work
- (optional) Remove the http:// protocol prefix from the hostname. It's not necessary

NOTE: I am also removing your host and secret key from your post, as you probably don't want anyone on the Internet to get hold of a copy of your site, right?

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!

user48265
I checked with my hosting provider (GoDaddy) and both cURL and wget are enabled. If I issue the following command from cron or ssh I get a 403 error, but if I issue it in a web browser it completes properly.
wget --max-redirect=10000 --output-document=/dev/null "http://www.isqccbe.org/index.php?option=com_akeeba&view=backup&key=Scorpio24"

Also, any advice on the 403 error from the backup.php cURL script?

nicholas
Akeeba Staff
Manager
There are two different things here.

The first thing "is wget / curl enabled" which translates to "can I run wget / curl from my hosting account". I was absolutely certain that the answer is yes. If it weren't, you wouldn't be able to run wget and get a 403 error in the first place.

The question you didn't seem to have asked your host is "can wget / curl running on any server in the world, including the one my site is hosted on, access my site or is there something like Apache's mod_security2 or another UA filtering mechanism preventing such access?". This is the question you have to ask your host.

Let me explain my thinking so that I can lead you to the correct questions to ask your host. When you try using wget you get a 403 error. When you try from a browser it works. The only differences are the origin of the request and the user agent string used.

1. The user agent string is a piece of text sent out by the user agent (browser, wget or curl) which tries to access your site. It identifies the user agent to the web server. Many hosts will deliberately block wget and curl as they consider them "potentially unsafe" user agents. This springs from the fact that some stupid wannabe hackers use them in their not-so-well-designed hacking scripts. Of course we want to use them for a legitimate purpose, therefore we need to make sure that the server allows to be accessed by wget.

2. The origin. When you are accessing your site over your web browser, there is a request sent out from your IP address to the web server. When you are using wget, there is a request sent out from the loopback IP address (127.0.0.1) to the web server. Many web servers are designed to forbid requests coming from an internal network or loopback IP address. You may need to ask your host if this is the case with their servers.

Knowing GoDaddy's support quality (or complete lack thereof) you may not be able to get any meaningful answers from the first level support technicians. They are typically some script-reading, underpaid, outsourced, generic support people who might not have any sufficient knowledge on the matter. If you seem to be getting a lot of meaningless replies, ask to escalate your support request. Level 2 support technicians are actual engineers who know what you're talking about and can really give a decent reply to your support request.

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!