Support

Site Restoration

#33473 Kickstart will no work when PHP version is set by .httaccess file.

Posted in ‘Site restoration’
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
CMS Type
Other
CMS Version
n/a
Backup Tool Version
n/a
Kickstart version
n/a

Latest post by nicholas on Friday, 07 August 2020 01:56 CDT

bartlidofsky

I am having a problem similar to Ticket #32467

On my host (Hostgator), the PHP version is set by .htaccess. Without it, the PHP version is set to 5.4. They currently have no way of setting it up  (they're promising to fix that "some time soon"). I have spent weeks developing my site on a test server, and it needs to be moved to the new server ASAP. One of the major reasons I bought a subscription to Akeeba was to transfer the site.

Is there anything I can do now?

dlb

Kickstart is only the extractor, it extracts the archive, then hands off to ANGIE, the embedded restore script.

Go ahead and change your PHP version through cPanel.  Make a copy of the .htaccess file because Kickstart may rename it making it inactive.

So Kickstart should run, but ANGIE won't, because Kickstart renamed the .htaccess file.  Before you start the restore, you'll need to go in via FTP or file manager and restore the copy you made of .htaccess.

I think that will work around the problem.



Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

bartlidofsky

Thanks. I've looked up and found some ANGIE instructions, so I'll try to do that. I used the manual instructions for moving the backup file (nice video!).

Kickstarter is stopping at the beginning of the extraction process, by the way. I'll see if I can do something about that, too.

 

dlb

I think what's happening is that it's extracting the .htaccess file in the archive, overwriting the one that's setting your PHP version.  We can get around it, but it would take a new backup - just exclude .htaccess from the backup.



Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

bartlidofsky

Not a problem. I'm almost resigned to do the worst case scenario: A manual move of the site. Both the test server and the final destination are running out of my reseller account. And, while the site transfer was a major reason for purchasing an Akeeba subscription NOW, I've been planning on buying one in any case. BTW, the default PHP version is 5.4.45 (yikes!).

I'm going to try your solution first, and also, based on another comment, going to run it on Chrome instead of Firefox.

If I can't get it to work now, I'll look up how to run Kickstarter in debugging mode, and see what comes up.

bartlidofsky

OK, ran it with debug. Here's debug.txt:

Preparing to scan archives
- Found archive /home1/quest/public_html/site-www.decants.com-20200728-132451edt-T1MmpHdbAkMJCZtc.jpa
Total archive parts: 1
Preparing to read archive header
Opening the first part
Current part is -1; opening the next part
Opening file /home1/quest/public_html/site-www.decants.com-20200728-132451edt-T1MmpHdbAkMJCZtc.jpa
Header data:
Length              : 27
Major               : 1
Minor               : 2
File count          : 12064
Uncompressed size   : 89365943
Compressed size	  : 36526904

---
And here's error.log:

[30-Jul-2020 12:24:33 America/Chicago] PHP Warning:  Version warning: Imagick was compiled against Image Magick version 1654 but version 1650 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0
[30-Jul-2020 12:25:01 America/Chicago] PHP Warning:  Version warning: Imagick was compiled against Image Magick version 1654 but version 1650 is loaded. Imagick will run but may behave surprisingly in Unknown on line 0

dlb

That's lovely but we really don't care about Image Magick.  Do you get any error message on the screen?  And it stops at that point?



Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

bartlidofsky

Yes. I took a screenshot (once again, I don't know how helpful it is, just trying to be complete}

dlb

It may be helpful - that's not an error.  Are you sure you're not rushing it?  I know the extraction process is very slow on my host.  It isn't normally slow, just when extracting.

I would expect Kickstart to throw an error if the PHP version was a problem.  There's nothing in the debug log and nothing on the screen.  That doesn't mean that Kickstart is still running, but that's the way to bet.



Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

bartlidofsky

That screenshot was from after 20 minutes of waiting (and nothing has been extracted).

nicholas
Akeeba Staff
Manager

First, please make sure that you are using Kickstart 7.0.1. What I am about to say only applies starting with 7.0.1. Older versions didn't have that feature.

When you start the extraction Kickstart looks for a .htaccess in the same directory it is located in. If one is found it reads it and looks for AddHandler lines or <Files> blocks with SetHandler lines – these are the two ways you can set up a custom PHP version in a .htaccess file.

First check: before you start the restoration do you have a .htaccess file? If it has AddHandler or SetHandler lines can you please paste here these lines?

If these lines are found Kickstart creates a .htaccess file containing only these lines. If you have enabled stealth mode these lines will be added to the stealth .htaccess

Second check: after clicking the Start button and the extraction starts do you see a .htaccess file on your site? What are its contents?

When Kickstart extracts your backup archive it automatically renames the .htaccess file to htaccess.bak to prevent conflicts. So it's not a matter of your backed up site's .htaccess getting in the way. We even do the same with .user.ini and php.ini files which contain PHP configuration information and can get in the way of extraction.

The checks I am having you make so far will tell me if the .htaccess file you started with contained adequate information for the custom PHP version in a semi-standard way and whether they are being picked up for being written back to a new .htaccess file. This might not be the source of your problem but it's a good start, getting rid of something obvious that tripped up even Dale.

My suspicion is that the problem lies elsewhere, probably the server blocking the second AJAX request which would start the actual extraction of the file. This could happen if there's a security rule which mistakes the request for something malicious. In this case you can extract your backup archive locally and upload the extracted files to your server to run the actual site restoration. Extracting a backup archive locally can be done with Kickstart, using a local web server (e.g. one set up with XAMPP, WAMPserver, MAMP etc). Just don't run the site restoration on your local machine, i.e. don't click the "Start the restoration" button in Kickstart :)

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!

bartlidofsky

Here is the current .htaccess file:

### AKEEBA_KICKSTART_PHP_HANDLER_BEGIN ###

### AKEEBA_KICKSTART_PHP_HANDLER_END ###

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.

  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml

# php -- END cPanel-generated handler, do not edit


Here it is after I started kickstarter (I just subscribed this week, so it is the latest one):

### AKEEBA_KICKSTART_PHP_HANDLER_BEGIN ###

### AKEEBA_KICKSTART_PHP_HANDLER_END ###


There is no .htaccess.bak file.

I can certainly throw together a LAMP server and do the extraction locally; I would eventually like to see this fixed, because I want to be able to put together sites on a development server, and then put them onto the final server (yeah, I know I can put Joomla into "under construction" mode), but some of these sites have existing sites that I don't want to remove until after the new site is ready).

Would it be a good idea for me to put a few more logging statements into the kickstarter php file to see if I can pinpoint the error better?

One more thing: I'm doing the manual transfer because the transfer wizard did not work. Would looking at the errors from that be helpful?

 

nicholas
Akeeba Staff
Manager

It looks like you applied the PHP version through cPanel after running Kickstart. Because you have the lines

### AKEEBA_KICKSTART_PHP_HANDLER_BEGIN ###

### AKEEBA_KICKSTART_PHP_HANDLER_END ###

with nothing between them you are confusing Kickstart and ANGIE. You are essentially telling them "we didn't find any AddHandler / SetHandler directives in the .htaccess file, ignore it".

Here's what to do.

  1. Delete your .htaccess file.
  2. Go to cPanel and apply the PHP version your site will be running under, e.g. PHP 7.3. This creates a new .htaccess file.
  3. Run Kickstart all over again. This modifies your .htaccess file.
  4. When the extraction finishes click the Run the Installer button and see it to completion. Among other site restoration duties, it will copy the AddHandler directive from between the AKEEBA_KICKSTART_PHP_HANDLER_BEGIN and AKEEBA_KICKSTART_PHP_HANDLER_END markers in the temporary .htaccess, paste them to the bottom of the htaccess.txt contents and save the entire thing as .htaccess proper.
  5. When the installer asks you to, close its tab. This gets you back to Kickstart.
  6. Back in Kickstart, click on Clean Up. This removes Kickstart, the restoration script (installation folder) and the backup archive.

Please follow these steps in this order and do not skip over anything, even if it sounds redundant.

Do note that if your backed up site's .htaccess already had a SetHandler or AddHandler line you might need to edit the resulting .htaccess file and remove the old lines to prevent your site breaking. There is no reliable, automated way to do that since you may have legitimate reasons to have multiple such lines in your .htaccess 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!

bartlidofsky

Thanks; will do that later today (New York time). If it doesn't work, I'm going to create a couple of clean subdomains to test things out on, and will report the results as thoroughly as I can (as Hostgator is a pretty popular host, although it has moved largely to Wordpress, they have a number of people in tech support who know Joomla).


Bart

bartlidofsky

Nicholas (and thanks to Dale, too, for his help!):

OK. Not closing the ticket yet, but I tried your steps, and got the same result (no .htaccess file was created). I created a subdomain, and tried the site transfer wizard.
It failed, too. ("Akeeba Backup cannot run Akeeba Kickstart on your new site. If you are trying to restore inside a subdirectory of an existing site this means that the main site is blocking access to the subdirectory; please contact your site administrator. In any other case you need to contact your host and verify that your default PHP version matches Kickstart's minimum requirements.").

I suspect I know the problem: Without an .htaccess file, the default PHP version is 5.4.45. Yuck. This would be endemic to Hostgator, which is not at all fun for me. I am going to do this one the old fashioned way (ftp the files across, backup and restore the database, manually go through the config.php file) because I have to start moving fast. For my other sites, I'll set up a LAMP system to try the fix that you suggested.

If this is the problem, then it is endemic to Hostgator, and probably to many more of the EIG websites, which would mean a somewhat bigger problem (Hostgator has only recently started supporting versions greater than 7.2).

Even if this is the case, I'm leaving the ticket open. The next few websites I'm doing I'll be upgrading in place rather than on a test server, but if you want me to run more tests for Hostgator in general, I'll be happy to run more tests, or give you access to a test domain.

nicholas
Akeeba Staff
Manager

Sorry, I need a clarification here.

When you went to cPanel and chose a different PHP version did HostGator not create a .htaccess?

Or did Kickstart not process the .htaccess that HostGator created?

In the latter case I'd appreciate if you could paste the contents of the .htaccess HostGator created.

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 tested this again on both a local server and a live server. If there is a .htaccess file present with the AddHandler or SetHandler line to set the PHP version when you start Kickstart then the .htaccess lines setting the PHP version are copied into a temporary .htaccess which survives throughout the extraction (Kickstart) and restoration (ANGIE).

Depending on your settings at the very last page of ANGIE you may have a problem when you close ANGIE and try to run Clean Up. Namely, if you select to either use the default Joomla .htaccess or select to remove the AddHandler/SetHandler lines this last step will revert your .htaccess back to something which DOES NOT have the correct AddHandler/SetHandler lines, i.e. you will be running on your server's default PHP version (5.4). In this case go to cPanel, select PHP 7.2 or later and then click on the Clean Up. You may have to redo that before going to your site's front- or backend page.

So based on this further and extensive testing I can tell you that your problem is that you either didn't create the correct .htaccess file setting the PHP version before running Kickstart OR you got confused by the behaviour of last step I described above.

If, however, you did manage to run Kickstart but it didn't finish extracting the backup archive then we can safely conclude that the PHP version is a red herring. Your problem in this case would be something entirely different, not the PHP version Kickstart sees. Based on your debug.txt file it's very likely that the problem has to do with which PHP modules are enabled in each PHP version. For example, if the zlib module is not loaded Kickstart can't extract the archive as there's no way to handle compressed data. Your alternative would of course work in this case as long as you remember to set the PHP version through cPanel before running the restoration script ANGIE (i.e. visiting the installation folder).

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!

bartlidofsky

OK:
I started out trying to do the Site Transfer Wizard from the test server to the final server, and it failed. So I followed the instructions for a "manual" transfer. I moved the backup file to the final server, renamed the kickstarter file, and ran it. It freezes on the beginning of the unpack (which is where I started on this ticket). Nothing gets unpacked.

Just in case there were files in the final server that might be creating  a problem, I tried the Site Transfer Wizard onto a subdomain of the final server that I had just created and set for PHP 7.3. I got the result mentioned above.

Here is the .htaccess file that Hostgator creates on selecting 7.3 (they have 7.4 as an option, but I have been told that 7.3 is a bit more stable on their servers):
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

Once again, when I run kickstarter, it freezes before unpacking anything.

nicholas
Akeeba Staff
Manager

 I started out trying to do the Site Transfer Wizard from the test server to the final server, and it failed.

That does make sense. Your final server was running on a version of PHP that's too old for Kickstart. The first thing the Site Transfer Wizard does is copy Kickstart over and then try to access it over HTTP. If it fails it tells you it can't proceed and proposes the manual site transfer method.

So I followed the instructions for a "manual" transfer. I moved the backup file to the final server, renamed the kickstarter file, and ran it. It freezes on the beginning of the unpack (which is where I started on this ticket). Nothing gets unpacked.

This makes perfect sense, too. For the same reason. That's why my previous reply said to first remove the .htaccess and apply a new PHP version.

Just in case there were files in the final server that might be creating a problem, I tried the Site Transfer Wizard onto a subdomain of the final server that I had just created and set for PHP 7.3. I got the result mentioned above.

OK, this is what wasn't clear to me. You won't be able to use the Site Transfer Wizard when your target server's PHP version is lower than 5.6.0. You'd need to apply a higher PHP version before trying to transfer the site. But that might fail because we never validated that Site Transfer Wizard would work under these conditions. We only validated the manual site transfer when the server has an ancient, obsolete and officially unsupported for 5+ years default PHP version.

Here is the .htaccess file that Hostgator creates on selecting 7.3 (they have 7.4 as an option, but I have been told that 7.3 is a bit more stable on their servers):

Um, I call BS on 7.4 not being stable “on their servers”. What they meant is that they don't trust their clients to have the good judgement on whether the software they are using is compatible with PHP 7.4 so they instead try to get them to use PHP 7.3 by spreading fear, uncertainty and doubt. But that's beside the point. PHP 7.3 is a good choice at the time of this writing and what we recommend ourselves.

Also, and most importantly for your support request, the .htaccess generated is exactly what I expected and what I tested that works.

Once again, when I run kickstarter, it freezes before unpacking anything.

After you click that Start button wait for 5 seconds and check the contents of the .htaccess file. I expect to see the following:

### AKEEBA_KICKSTART_PHP_HANDLER_BEGIN ###
AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
### AKEEBA_KICKSTART_PHP_HANDLER_END ###

This would mean that Kickstart figured out that you have a special instruction to upgrade the PHP version and kept it in a special way inside a temporary .htaccess file. If you see something different tell me what you see and stop reading here :)

If the .htaccess file contains what I showed above create a new file called phpinfo.php with the following single line as its contents:

<?php phpinfo();

Now access it over the web, e.g. https://www.example.com/phpinfo.php where https://www.example.com/ is the URL to your site. What is the PHP version printed at the top of the page? Moreover, do you see a zlib section further down the page? This will tell me if the AddHandler line really takes effect and whether your server meets the minimum requirements for extracting the backup archive (which in itself is a subset of the minimum requirements for running Joomla). If it's not meeting these requirements you will need to contact HostGator and ask them how you can enable PHP modules for PHP 7.3 on your account and enable zlib, mbstring, mysqli and xml at the bare minimum.

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!

bartlidofsky

OK, starting clean, with a full backup transferred to the public_html directory of the permanent site.
1) Backup .htaccess
2) Delete .htaccess
3) Delete error_log and debug.txt to start the former fresh and  get rid of the latter
4) Used cpanel to set the version to 7.3.
5) Checked .htaccess. Matches what you expected.
6) Ran phpinfo(): PHP Version is 7.3.20, zlib is 1.2.3, there is a zlib section, mbstring is enabled, there is an msqli section (mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $), and xml (including xml reader and xml writer) are supported.
7) Checked version on Kickstarter Pro IS 7.0.1. Renamed, and with debug turned on.
8) Tried:
Archive Directory: public_html
Archive File: Correct
Extraction Method: Hybrid
Ignore Most Errors: Unchecked (should I check it?)
(S)FTP host name: localhost
(S)FTP port: 21
Use FTP over SSL (FTPS): Unchecked
Use FTP Passive Mode: Checked
(S)FTP user name: {correct name}
(S)FTP password: {correct password}
(S)FTP directory: ./public_html
Temporary directory: /home1/{site directory}/public_html/kicktemp (kicktemp is 755).
Check Temporary Directory: Is writable
Check ftp: checked
Fine tune: all defaults

Run, at "Extracting" screen, freezes.
kicktemp is empty.
debug.txt and error_log are back, contents as previously reported.
.htaccess file contains:

### AKEEBA_KICKSTART_PHP_HANDLER_BEGIN ###

### AKEEBA_KICKSTART_PHP_HANDLER_END ###


Hope this helps!

P.S. phpinfo() now reports PHP Version 5.4.45

nicholas
Akeeba Staff
Manager

I couldn't reproduce your issue... but I had an epiphany. There's a TAB character or spaces in front of your AddHandler line which were not copied when you pasted the file's contents in your ticket. Sure enough, adding a tab or spaces in front of the AddHandler line and I can now reproduce your issue on both the local and the live servers.

So, revised instructions for transferring the site:

  1. Delete your .htaccess file.
  2. Go to cPanel and apply the PHP version your site will be running under, e.g. PHP 7.3. This creates a new .htaccess file.
  3. Edit the .htaccess file. Remove all spaces or tab characters in front of the AddHandler line.
  4. Run Kickstart all over again. This time it will work.

I will make some changes in Kickstart and possibly ANGIE to take spaces and tabs into account. Thank you for your feedback, this was a use case in cPanel I had not run into before, which is quite a surprise considering I've been developing Akeeba Backup and doing end user support for it since 2006. Well, there's always something new to learn.

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!

bartlidofsky

Thank you so much! I am not surprised; Hostgator has just started this method of setting the PHP version in the last month or so. I had started the manual update, but I'm trying out the new one right now.

Bart

bartlidofsky

It worked fine! Didn't fix Site Transfer Wizard, but did fine for the "manual" transfer (copy the backup file and renamed kickstart.php to the home directory and run from there). The only problem I found was that I had to clean up manually. The site is working, so I'm assuming I did it properly, but if there's any warning, I'd appreciate it.

If there's a next time, I'll include the files as attachments rather than copy and paste into the message!

Thanks again!

(going to leave the ticket open for a day in case there's something else you want to say; if you want to close it, that's fine, too!)

nicholas
Akeeba Staff
Manager

I am glad we could help and thank you for bringing this to my attention. There were two small bugs, on in Kickstart and one in ANGIE, which didn't come up during our testing. Next versions – scheduled for late August to early September – will include these fixes.

Have a nice day and a great weekend!

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!