Redirection loop while trying to install v2.0

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Redirection loop while trying to install v2.0

Post by otopanne »

Dear CMSMS-people,

I have downloaded the version 2.0 release of this fantastic CMS and am trying to install it on my (shared) server.

Initially, I was trying to upgrade my 1.12.1 website, but when I point the browser to mywebsite.site/cmsms-2.0-install.php it tells me "the server is redirecting the request for this address in a way that will never complete"

On a local xampp it works like a charm, the upgrade was succesfull and I can now play with the new CMSMS 2.0 (which looks pretty awesome!)
To try and solve the upgrading issue I attempted to do a clean install of v2.0 on the webserver, but just as with the upgrade the phar installation file hangs in a redirection loop. I have tried different browsers (Firefox, Chrome).
Ofcourse, I could do the upgrade on the local installation and then upload the entire package to the webserver, but (with ease of upgrading in the future in mind) I would like the phar to work on my webserver as well.

There is nothing in the error log. In the access log there are 22 lines like this:

Code: Select all

xx.xxx.xxx.xx - - [15/Sep/2015:17:07:02 +0200] "GET /cmsms-2.0-install.php/index.php HTTP/1.1" 301 20 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"
I have checked readme.txt and it says requirements are:
- php 5.4.11 -> I have 5.6.12
- phar, json, tokenizer, xml, and gd should all be enabled -> they are according to phpinfo

I have also uploaded the upgraded package to the server and front- as well as backend seem to be working perfect, so the server seems fit enough to run 2.0. It is just that the phar installation is stuck in a loop.
I hope somebody can help me to fix this problem. Ofcourse if you need more info, I can provide :)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Redirection loop while trying to install v2.0

Post by calguy1000 »

If you are using 1and1 hosting.... (or something similar) it could be a host limitation, and you will have to use the expanded installer.

See this thread:
http://forum.cmsmadesimple.org/viewtopi ... 84&t=73366
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

Thanks for the swift respons, Calguy1000!

I have read the thread you link to in my search for clues. But since it was solved during the beta, I assumed it was a different problem.

From your questions to spcherub in that thread:
- There is no .htaccess.
- From the System Information:
Server API (server_api): litespeed
Server Software (server_software): apache
Server Operating System (server_os): linux 2.6.32-604.16.2.lve1.3.54.el6.x86_64 on x86_64
I have downloaded the phar_test and after I tried to load build.php I get a line in the error log:
[Tue Sep 15 21:25:58 2015] [error] [client xx.xxx.xxx.xx] [host mywebsite.site] Backend fatal error: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'creating archive "test.phar" disabled by the php.ini setting phar.readonly' in /home/xx/domains/xx/public_html/upgrade/build.php:2\nStack trace:\n#0 /home/xx/domains/xx/public_html/upgrade/build.php(2): Phar->__construct('test.phar', 0, 'test.phar')\n#1 {main}\n thrown in /home/xx/domains/xx/public_html/upgrade/build.php on line 2\n
It says phar.readonly is set to disabled. So I checked with xampp's php.ini file, only to find that the line question is still commented out. So I tried to phar_test on xampp as well: same error. Since the phar works on xampp, I assume that this is not the actual problem which causes the redirect loop. The search continues...

So from your suggestion and the info in the thread I've tried the extended installer. I've tried adding ?debug=1 to the url, but since I'm not seeing any debug info, I guess that has been disabled by host configuration. During the process nothing is logged in the error report.
On step 3 I do get warnings for E_STRICT and E_DEPRECATED, PHP script max execution time of 30s and disabled functions: system, exec, shell_exec, passthru, proc_get_status, proc_nice, proc_terminate, dl, popen, pcntl_exec
These are known warnings to me and by succesfully ignoring them I've been able to upgrade from 1.8.? to 1.12.1 over the years. Has something changed? Is one of these disabled functions now required to install the phar?

In the end I've been able to walk through the process of installing a fresh copy of v2.0 and upgrading to v2.0 by using the extended installer.
But I would still like to solve the inital loop problem with the phar, as a single file upgrade seems like the best idea ever!!

Do you have any more ideas what I can do to pinpoint the problem?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Redirection loop while trying to install v2.0

Post by calguy1000 »

it was 'solved' during the beta in that we determined for a fact that the issue was related to that host and not our code.

It could not even run the most trivial of phar file... and could not run the expanded installer unless it was in a subdirectory.

we did not have access to sufficient enough logs to tell us exactly what the issue was. But my guess with the 1&1 host would be: a custom built version of PHP without the appropriate fixes... and/or mod_security.

my personal opinion: mod_security sucks.. particularly when used as a blanket solution by an ISP.

my answer: talk to your host.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

So spcherub is now enjoying his v2.0 installed with the extended installer, not with the phar.

Please appreciate that I'm not trying to point any fingers or even dare to say that something is wrong with the code (or with the host configuration).
I'm in the middle of two parties who definitely have more experience with these sort of thing, I'm just here trying to upgrade my website with a single file phar, because I really like the idea of that :D

I'm not with 1and1 or any other typical cheap host. I'm with a company that is certainly within the top-5 of my country. I have never had any problems with the uptime or quality of the server. They are nice people who are always willing to help out or look at possible solutions.
They allow me select between PHP 5.4.44, 5.5.28, 5.6.12 and even 7.0.0beta3. For as far as I know these are the standard out-of-the-box versions, not modified versions or custom builds.

I have tried to find out if mod_security is running. I can not find any reference to mod_security in phpinfo. Also, from what I understand Litespeed has very poor support for mod_security, so chances are likely that is the issue here. How do I know for sure whether mod_security is running and interfering the process of installing the phar?

I have already emailed my host, after checking the logs they replied that the loop could be created in the phar at line 70.
From my basic php knowledge and basic debugging skills I've gathered that $pt on line 68 does not meet the condition to run the 301 redirect as $_SERVER['REQUEST_URI'] and basename(__FILE__) give the expected output.

If I talk to my host again, what is it exactly I should ask? Are there some magic words that will allow them to understand this particular issue and find a way to resolve the loop in the phar?
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

I think the phar is a real break-through for CMSMS, as it will make upgrading so much faster and easier. I would really like it to work. Am I the only one (apart from spcherub) having this redirection loop problem?

Can you please explain what it is I should talk about with my webhost if I would like the single file phar to work?
Which information is needed and which tests can we do to pinpoint the problem?
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

The single phar is still not working for 2.0.1

May I please ask you again, Calguy, how can I find out which specific server configuration setting is causing the 301 redirection loop and breaking the installation?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Redirection loop while trying to install v2.0

Post by calguy1000 »

CMSMS Uses the standard phar 'stub files' and we generate the phar with a version of php with all known fixes to those stubs. So the issue with the 'line 70' is not a CMSMS issue, but a host issue.

* mod_security will not show up in your phpinfo stuff typically.

With 1&1 We were unable to determine exactly what the cause was. just that it was a host issue. It may be a litespeed thing, I dunno. Google searches for 'redirection loops' with litespeed didn't bring anything specific up related to phar's.

Like we said, I tested with a trivial phar file with some really really simple code (source file attached). and could reproduce the problem.
Attachments
phar_test.zip
There is a build.php file here to build the sample phar... it must be run from the CLI on a host where phar.readonly is turned OFF.
(1.57 KiB) Downloaded 188 times
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Redirection loop while trying to install v2.0

Post by calguy1000 »

Here is the trivial phar file. (rename it to .php and upload in binary mode).
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

Thanks for your reply, CG! Very much appreciated! ;D

Unfortunately I do not have access to an CLI (the host is currently working on allowing SSH)
From what I understand from the read me, release notes and scattered posts on the forum, CLI/SSH is not a prerequisite to run the new 2.0, am I right?

Am I also right in believing that the new phar (or CMSMS in general) in theory should be able to work on all server environments? Whether that's a high-end server where the admin has full control or a shared-server running the latest (required) software?

This is the full list of requirements? Or are there more things one should look for in a host/server?
1. The installation assistant requires a PHP environment with a minimum version of PHP 5.4.0 with the Phar library enabled.
2. For new installations of CMS Made Simple you should create a new mysql database and database user. The database user must have ALL PRIVILEGES to all tables within the new database.
3. CMS Made Simple itself requires at least PHP 5.4.11 with numerous libraries enabled (the install assistant will check for these) including json, tokenizer, xml, and gd.
4. Your PHP environment must include the PHAR extension
(from readme-phar.txt)


Anyway, I have send an email to the host and asked them to run the phar test and get back to me with the results. Hopefully that will give us more information.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Redirection loop while trying to install v2.0

Post by calguy1000 »

You do not need CLI access to run the phar installer, or the trivial phar that I uploaded. You just upload them in binary mode, and browse to them.

CLI access is needed to 'build' the test.phar... the source of which I attached below.

The theory is that the phar file will operate in 'most' hosts.. There are already at least one host that the installation assistant (even the expanded version) will not run on at all because of configuration settings. things like 'putenv' not allowed, or 'phar' extensions disabled etc. (the phar extension is used for more than just reading phar files).

We do not yet know why even the trivial phar file results in a redirection loop on some hosts. The generation is literally 3 lines of code. The other files are one line each (echo statements). Either way, I believe that to be a host issue, and nothing we can adjust.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
otopanne
Forum Members
Forum Members
Posts: 20
Joined: Tue Sep 15, 2015 4:43 pm

Re: Redirection loop while trying to install v2.0

Post by otopanne »

File comment: There is a build.php file here to build the sample phar... it must be run from the CLI on a host where phar.readonly is turned OFF.
calguy1000 wrote:You do not need CLI access to run the phar installer, or the trivial phar that I uploaded. You just upload them in binary mode, and browse to them.
This caused a bit of confusion, but clear now, no CLI needed!

So, I have ran the test from phar_test.zip again, uploaded the files (in binary mode), browsed to ../build.php and got an blank page.

The error log states:

Code: Select all

[Sun Oct 04 22:55:16 2015] [error] [client xx.xxx.xx.xxx] [host www.website.tld] Backend fatal error: PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'creating archive "test.phar" disabled by the php.ini setting phar.readonly' in /home/.../domains/.../public_html/test/build.php:2\nStack trace:\n#0 /home/.../domains/.../public_html/test/build.php(2): Phar->__construct('test.phar', 0, 'test.phar')\n#1 {main}\n  thrown in /home/.../domains/.../public_html/test/build.php on line 2\n
So, on the webserver phar.readonly is set to ON.
On localhost (through xampp) where I have been able to install the phar with the same setting, phar.readonly set to ON.

So I will ask my host if they will change the setting to OFF? Will that solve the redirection issue?
Can you explain why it did work on localhost, but will not on the server with phar.readonly set to ON?

I have also ran the test.phar.txt which was first renamed, than uploaded in binary mode. When I browse to it, I get "the server is redirecting the request for this address in a way that will never complete", no further information in the error log.
Locked

Return to “[locked] Installation, Setup and Upgrade”