htmly icon indicating copy to clipboard operation
htmly copied to clipboard

Installer: Bad site.url config variable on Windows

Open bttrx opened this issue 3 years ago • 2 comments

@danpros For testing I installed HTMLy 2.8.2 on a portable Apache 2.4.x + PHP 5.4.x webserver on Windows (XP). I noticed the installer assigns, e.g., http://localhost/\/ to site.url. This results at least in a strange browser URL like http://localhost///admin/config for the admin panel. The problem comes from function generateSiteUrl(), where dirname() is used incorrectly, because on Windows the directory separator is \, not /. Fortunately PHP has the directory constant DIRECTORY_SEPARATOR.

I will submit a PR for fixing. This PR will also rearrange the dir code in generateSiteUrl() to make it more readable.

bttrx avatar Oct 30 '22 19:10 bttrx

Um, it's a little more complicated than I first thought. Version 2.8.2 code works fine, when the installer is started from a sub-folder, e.g., "htdocs/blog/install.php". But when in document root, i.e., "htdocs/install.php" it reports "dir" being "\\" (two backslashes, one is probably for escaping) on error_log(print_r($dir, true));.

bttrx avatar Oct 30 '22 20:10 bttrx

Hello,

Please make PR if you find solutions for it.

Thanks,

danpros avatar Jan 11 '24 03:01 danpros