pH7Software / pH7-Social-Dating-CMS

😻 pH7Builder (formerly pH7CMS) is a Professional & Open Source Social Dating CMS written in PHP 8 🚀 This Social Dating Script aims to be low resource-intensive, powerful and secure. pH7Builder includes over 40 modules. It is the first Professional, Free & Open Source Social Dating Site Builder Software and the first choice for enterprise level Da
https://pH7Builder.com
MIT License
957 stars 574 forks source link

installation on localhost doesn't work #337

Closed rubo77 closed 5 years ago

rubo77 commented 5 years ago

I tried to install on Ubuntu 18.04 with Php7-fpm and nginx

  1. git clone the repo
  2. chmod 777 the folder, so it can creat the install folder
  3. call http://localhost/pH7-Social-Dating-CMS in firefox (with ublock origin and uMatrix addons)
  4. select englich and click "Next step

Now the error occurs, the following page lacks the corect URL, it redirects to

http://_/pH7-Social-Dating-CMS/_install/?a=license

if I correct this to http://localhost/pH7-Social-Dating-CMS/_install/?a=license I see the next page, but there it is not possible to continue. Whenever I click on "Next" I get back to http://_/pH7-Social-Dating-CMS/_install/?a=license

I found this in the code:

<form method="post" action="http://_/pH7-Social-Dating-CMS/_install/?a=license">
pH-7 commented 5 years ago

That's very strange. It's the first time I see such an error! I will check in the code and I will get back to you ASAP with more details.

pH-7 commented 5 years ago

Your error is from that line https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/8a5eceaf111daac5b3537e79b953d37b0fc8d96c/_install/constants.php#L20

It looks like your SERVER_NAME from your server configuration isn't correctly set. Apparently, in your case, it is set to _ instead of localhost.

polynamaude commented 5 years ago

Maybe you should review some basic Apache configuration skills before going on with trying to host a CMS ;-)

rubo77 commented 5 years ago

_ is the default on a local nginx.

It shouldn't break if the server defined host is differing from the used host.

You need another variable.

polynamaude commented 5 years ago

Well if it could work, may I ask why you didn't try it out ? I don't understand how could $_SERVER['SERVER_HOST'] would work ?

Maybe you should take a look here : http://php.net/manual/en/reserved.variables.server.php

And after think about how it works with virtual host !

Oh and if it works for you, then great ! Cheers !

rubo77 commented 5 years ago

$_SERVER['HTTP_HOST'] would be the correct variable instead of $_SERVER['SERVER_NAME']

polynamaude commented 5 years ago

FYI, the variables starting by HTTP are set by the client and can't be trusted.

Maybe you need to refresh some skills !

On October 26, 2018 7:40:31 AM EDT, Ruben Barkow notifications@github.com wrote:

HTTP_HOST i would be the correct variable

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/pH7Software/pH7-Social-Dating-CMS/issues/337#issuecomment-433379904

-- Polyna-Maude R.-Summerside

rubo77 commented 5 years ago

I know but in this case this is what you want. This point is not about trust. At this point the installation should work with localhost as URL.

And that would work if you would use http_host as host part.

I didn't check where you use $sDomain, but maybe you should just not use it at this point to generate the URL.

Best would be just to link relative in that form

polynamaude commented 5 years ago

The problem is simply that you need to change the default configuration in NGINX. There's design choice that we won't change to make it easier for you because you don't want or don't know how to change the configuration in NGINX.

Maybe you should learn that because something doesn't work out of the box, with only click click click it doesn't mean that it's broken. It mean that it needs to be configurer ;-) And believe-me, you'll have problem with other software too if you don't change the name of your host.

And by the way, smart guy ! A simple way to solve your problem is to add the default name of NGINX instance for local to your host file. That is : _ 127.0.0.1

Case closed / done / over / have a nice and happy living.

polynamaude commented 5 years ago

I like those guys who fill your "issue" with ones that aren't real problem but more that they don't handle their configuration properly and after they tell you "do this, do that" but they don't even ask themselves why did some choice we're done in the beginning. Oh yes maybe we chose to use SERVER_NAME because it is always set by the server and never cause any problem but HTTP_HOST is filled by header and they often get messed up, like when using a redirecting proxy !

rubo77 commented 5 years ago

(First of all, I am not "one of those guys". I am a Server administrator and PHP Programmer since 20 Years, so I know how to config apache and nginx properly, but thats not the point. We shouldn't talk about judging others here. Lets stay focussed and go back to topic...)

I want to help here to create a great user experience for newcomers that try to install the app.

Why are you using complete URLs all through the project instead of relative URLs? This makes it problematic in the default nginx installation. If you would use relative URLs in the <form action""> there would never be any problems.


To solve this issue, I suggest to add these lines in constants.php:

if($sDomain!=$_SERVER['HTTP_HOST']) {
  echo '<div style="color:red;align:center">
     WARNING! You have to adapt your webserver configuration to point with the
     host "'.$_SERVER['HTTP_HOST'].'" to the pH7 directory!
  </div>';
  $sDomain=$_SERVER['HTTP_HOST'];
}
polynamaude commented 5 years ago

Thank you

pH-7 commented 5 years ago

Thanks for the suggestion @rubo77! I really appreciate it :) I will publish a fix later on for the next release.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Thanks, Pierre-Henry