New Install and I am getting weird issues

MrCaspanMrCaspan New
edited January 24 in Vanilla 3.x Help

So I installed 3.3 last night and I am getting weird issues. When I try to post my rich editor shows up then after 1-2 seconds disappears.. I opened up the console in Chrome and I got this


based on the fact it was talking about API stuff i wen to the API second on the dashboard and i am seeing this error



Also in the root of the site I am seeing this error in the error log

[24-Jan-2020 15:28:08 UTC] PHP Warning: dateTimeToTimeStampcalled with bad input in /home/mainnu/www/pf.main.nu/library/Vanilla/Formatting/DateTimeFormatter.php on line 228

Any ideas?

I am running PHP 7.4 on Linux

«1

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Vanilla requires nice urls. Add $Configuration['Garden']['RewriteUrls'] = true; to your /conf/config.php


    You can safely ignore the PHP warning


    MrCaspan
  • This broke the whole site and every link now goes to the Homepage only...


    Please remember this is a default fresh install with nothing done to it..

  • So I deleted the .htaccess as i assumed this was redirecting to the site home page and all seems like it works now!


    Thank you!

  • I spoke too soon. Now it cannot find any of the pages... everything is a 404


    How is it possible i screwed up a fresh install?? I just installed and told it to use .htaccess, should I not use an htaccess. That is really the only option i have when installing!

  • MrCaspanMrCaspan New
    edited January 24

    So i have friendly URLs on and i can see that if i look at the URLs of my categories. If i turn it off i can see the ugly URLs.. But i can only seem to get everything to work if i use ugly URLS then i can traverse the site.. If i turn friendly URLs on its like the rewrite sees the pretty URL and just redirects to the home page... Here is a copy of my my .htaccess

    You can see a copy of the site here

    http://pf.main.nu/discussions and this does not take you to the discussions page it takes you to the home page which is catagories

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Sounds weird, I agree. Yes, you need to use the .htaccess that comes with Vanilla. I think it is called .htaccess.dist and you might haveto rename that. And if that is not enough, you need to add the line above to your config.

    Currently your page shows what I would say are the installed PHP extensions...?


  • Are you sure you are on an Apache server (not nginx) and that rewrite rules are enabled?


    https://open.vanillaforums.com/discussion/comment/220157/#Comment_220157

  • Done a check, you are on apache, you still should check that mod_rewrite is enabled.

    Also you are using PHP 7.4.1 I don't think the software is 7.4.1 ready although I have tested on 7.4.1 with with no issues, probably better to revert to PHP 7.3 seeing as you are having several different issues on install.


    >>> http://pf.main.nu/discussions

    > --------------------------------------------

    > 200 OK

    > --------------------------------------------

    Status:200 OK

    Code:200

    Date:Sat, 25 Jan 2020 12:41:39 GMT

    Server:Apache

    X-Powered-By: PHP/7.4.1

    Upgrade: h2,h2c

    Connection: Upgrade, close

    Content-Type: text/html; charset=UTF-8

    phreak
  • MrCaspanMrCaspan New
    edited January 25

    So I triple checked with my hosting company and they have confirmed that mod_rewrite is on and set up a test to prove it. They put a file called htaccess_tester.php in the root and setup an .htaccess file when I visit my site http://main.nu rewrites to the page properly and this is on the same shared server and the other site is on.

    I did set my PHP to 7.3 just to make sure but still has the same issue.

    I have removed some test coding i was using before so you can see but the index.php seems to IGNORE pretty URLs as input. If I switch back to old ugly links it works but it breaks the ability to respond to posts and I get a bunch of errors in the scripting console.

    I am not sure why if the site will only 95% workout pretty URLs on why did I have to manually to the config if the site REQUIRES this to function as i was told in an earlier reply. Why is there even an option for ugly URLs if it does not work? Is it for troubleshooting or something? Just trying to understand better what is going on.

    Also I added a phpinfo file so you can see my settings http://pf.main.nu/phpinfo.php

  • I have replaced my HTACCESS file with the .dist version and have the same issue You said if that is not enough that i need to add the line above to your config? is that the rewrite URL line you said in your first reply? if so i have added that.

    as to question about php extension were me testing to see what was installed.

  • MrCaspanMrCaspan New
    edited January 25

    Also just as a test i cleared my cache on the ftp server (minus the HTACCESS) still same result

  • Did you do another clean install after changing your PHP to 7.3? I am guessing it never installed properly on PHP 7.4.

  • MrCaspanMrCaspan New
    edited January 25

    I can test that! Good point.

  • Yes, the clue is the PHP errors you mentioned earlier in the thread.

  • So brand new install and still the same issues. It's like the index.php is ignoring the option to use RewriteUrls and is assuming its a 404 so just redirects it to the home page. I can type in a fake address like http://pf.main.nu/bsdfbasdfbasdfbasdf or a real URL clicked on from the site and it ignores the path completely!!

    Why is it you have to manually add the line $Configuration['Garden']['RewriteUrls'] = true; to the config.php if the site wont work properly without it? DO you know? if its important to the functioning of the forum why is it not added during the install?

  • MrCaspanMrCaspan New
    edited January 26

    So i have tried installing with PHP 7.1, 7.2, 7.3, 7.4 all have the same issue the very fresh install after changing config to manually add RewriteUrls and this is what is in the console...


    Something is wrong with this build that I downloaded from https://open.vanillaforums.com/addon/vanilla-core-3.3


    These are the options i have enabled for PHP 7.2 that the site is currently running

    I have also tried disabling all plugins and still getting the same errors in the Console and there are no PHP errors in my logs

  • MrCaspanMrCaspan New
    edited January 26

    Okay so I have narrowed it down to the Rewrites not working.. the reason I am getting all those errors in the java console is because rewrites are not working and when the site is trying to access http://pf.main.nu/api/v2/locales/en/translations.js?h=3.3 the main site is being returned as HTML and of course that is not the JS its expecting to be there. hence all the errors in my Console. Everythign that the site is calling using a rewrite URL is returning the HTML for the homepage.

    I know 1000% for sure rewirtes are working on my server through 15 tests... they are working so that is not the issue.

    I know the site is reading the RewriteUrls setting from the config.php because all the URLs on the forum change to friendly URLs. It seems though that the site code ignoring the passed URI to it or the URI is not getting passed properly..

    So this boils down to that the HTACCESS file is not passing the URI properly to the index.php, or the code has a bug somewhere in it and not reading the URIs properly or is ignoring the RewriteURLs setting in the config!

  • MrCaspanMrCaspan New
    edited January 26

    Okay sorry for posting AGAIN I think i have figured it out....

    so in library\core\class.request.php i found this comment...

          // Some hosts block PATH_INFO from being passed (or even manually set).

          // We set X_PATH_INFO in the .htaccess as a fallback for those situations.

          // If you work for one of those hosts, know that many beautiful kittens lost their lives for your sins.


    Guess what my hosting provider is one of those places that block PATH_INFO so then programmers tried to do a work around and set a environment variable in the .htaccess to compensate for that but to allow the .htaccess file to change environment variables you have to have the mod_env loaded for Apache.... guess what I don't have that loaded!!! I did a dump of $_SYSTEM from library\core\class.request.php and there are no 'X_' keys set..

    So it seems they never thought what would happen if neither were set, so there is a failure to logic to assume something actually is false just because it's not there.

    R_J
  • Okay so i have it 3/4 solved


    I added the following line to that logic as i don't have access to PATH_INFO or X_REWRITE it was the only way to get this to work!!

        if (!empty($_SERVER['X_REWRITE']) || !empty($_SERVER['REDIRECT_X_REWRITE'])) {
          $path = $_SERVER['PATH_INFO'] ?? '';
    
    			
          // Some hosts block PATH_INFO from being passed (or even manually set).
          // We set X_PATH_INFO in the .htaccess as a fallback for those situations.
          // If you work for one of those hosts, know that many beautiful kittens lost their lives for your sins.
          if (!$path) {
            if (!empty($_SERVER['X_PATH_INFO'])) {
              $path = $_SERVER['X_PATH_INFO'];
            } elseif (!empty($_SERVER['REDIRECT_X_PATH_INFO'])) {
              $path = $_SERVER['REDIRECT_X_PATH_INFO'];
            }
          }
        } elseif (is_array($_GET)) {
          if (isset($_GET['_p'])) {
            $path = $_GET['_p'];
            unset($_GET['_p']);
          } elseif (isset($_GET['p'])) {
            $path = $_GET['p'];
            unset($_GET['p']);
          } elseif (isset($_SERVER['REQUEST_URI'])) {    // added this
    	$path = $_SERVER['REQUEST_URI'];             // this
          }
        }
    
    

    Now my API calls for translations i have to get to work for example when I hit this URL http://pf.main.nu/api/v2/locales/en/translations.js?h=3.3 i get the following 404 error


    {
        "message": "/api/v2/locales/en/translations.js?h=3.3 not found.",
        "status": 404,
        "description": null
    }
    

    but when i hit http://pf.main.nu/api/v2/locales/en/translations.js it returns me the whole translation file so i know that is working but i just have to do some double testing if this is by purpose or by error

    phreak
  • MrCaspanMrCaspan New
    edited January 27

    yeah and now the API page is loading!! How do we tell a dev about this issue so they can add the code incase others have the same issue?


Sign In or Register to comment.