Slow site after move to new server

I recently upgraded my shared hosting package which required my existing Kirby site to be moved to a new server. Things seem sluggish now and sometimes pages timeout. Then again, sometimes everything seems to work fine. I have tried switching the PHP version being used. That seemed to help but the problems have returned. Also, I reuploaded the .htaccess file from the Starterkit.

I have a backup of the site. Perhaps a fresh install would be best? I have the feeling that there is some conflict between the PHP version that was used during the install on the old server and the one being used on this new one. Could that be the problem?

Thanks in advance.
Kurt

did you try enabling php errors in the config?
https://getkirby.com/docs/cheatsheet/options/debug

which version is your current kirby installation?

Do you generate a lot of thumbnails on the site? After the move the thumb generator probably runs again for all your images. Make sure the thumb folder is there and writable. When all thumbs are regenerated the site should be fast again.

I am running the latest version of Kirby (2.2.3). I will try enabling php errors in the config. How do I actually view the errors then (if there are any)?

The thumbs folder if writable and there are currently 32 thumbnails in it. That’s not a lot, is it?

I noticed that when experimenting with different PHP versions on the server (5.4, 5,5, 5,6 and 7) that some work better than others but none is completely stable. For example with 5.6 I can no longer log into the panel and get this message:

I’m thinking a fresh install might do the trick?

Kurt

Nothing seems to be writable. I got 0750 on my folders and 0640 on my files. Check yours on your server.

most ftp clients allow for setting defaults chmod settings for uploading files and folders.

or you could use php at kirbys root folder. use the following script at ourown risk.

<?

  header('Content-Type: text/plain');

  /**
  * Changes permissions on files and directories within $dir and dives recursively
  * into found subdirectories.
  */
  function chmod_r($dir, $dirPermissions, $filePermissions) {
      $dp = opendir($dir);
       while($file = readdir($dp)) {
         if (($file == ".") || ($file == ".."))
            continue;

        $fullPath = $dir."/".$file;

         if(is_dir($fullPath)) {
            echo('DIR:' . $fullPath . "\n");
            chmod($fullPath, $dirPermissions);
            chmod_r($fullPath, $dirPermissions, $filePermissions);
         } else {
            echo('FILE:' . $fullPath . "\n");
            chmod($fullPath, $filePermissions);
         }

       }
     closedir($dp);
  }

  chmod_r(dirname(__FILE__), 0755, 0644);
?>

I did a fresh install of Kirby but the problems persist. I really think it has something to do with the images (thumbs?) on the site. Pages with images are the ones which are really sluggish. Also, things are very sluggish in the panel. For example, when I click on “Site Options” it takes about 30 seconds for the page to load.

I switched on PHP errors in the config file but how do I actually go about seeing the errors?

Thanks.
Kurt

There should be a php error log file somewhere on the server, usually in a logs folder.

Does Kirby create any thumbs? Maybe Kirby tries to create thumbs but fails for some reason. To test this, you can remove all thumbs from the folder and check if any new ones are generated.

I have found the logs folder. There are lots of access_log and ftp_log files in it but nothing PHP related. Does that mean that there are no PHP errors?

I deleted all of the files in the thumbs folder and then re-uploaded some images to test it. Images are being written to the thumbs folder. I actually deleted all of the image files on the site and re-uploaded them. This sames to make the pages load faster.

I have been experimenting with switching PHP versions in the .htaccess file. Using AddHandler php54-cgi .php seems to work the best (but still does not seem 100% stable to me). Any of the other versions I try (5.5, 5.6, 7.0) make the panel really sluggish. This would confirm that it’s the PHP version, right? I am using the Privat Plus package at All-Inkl.com. I originally had this site installed using their normal Privat package and had no problems with the site. It was only after the upgrade to Privat Plus (which requires a server change) that I started seeing the problems. Would it help if I shared my URL?

Thanks,
Kurt

There should be an error_log file as well. Maybe you have to enable it first in the hosting configuration.

Hm, normally PHP 7.0 should be way faster than the older versions.

So for best performance I should actually be trying to use PHP 7 if possible?

I added AddHandler php70-cgi .php to the .htaccess file and now everything seems much more stable and to be loading much faster - pages and panel. I am not sure why I had problems with version 7 earlier. I think I switched to version 7 using the host’s settings rather than the .htaccess file. Hopefully this solves the problem for me.

Thanks!
Kurt

I take the last message back. Now the panel is suddenly loading very slowly again. Do I need to change any settings in Kirby after I set the PHP version to 7 in the .htaccess file?

I am still working on switching on PHP error logging. Apparently this is not built into All-Inkl hosting. I found this solution but I am not sure if I understand how to do it:

http://mkleine.de/blog/2014/11/02/all-inkl-php-error-log-aktivieren/

Kurt

No, Kirby shouldn’t need any changes after the version change (since you are running the latest Kirby release, which is compatible with PHP 7).

Hm, seems like you need to add that to your .htaccess as well and create the directory. Doesn’t seem very elegant, but I haven’t found any other solution either.

Probably you should contact them and ask them if they can properly enable the error log for you.

Okay. I wrote to All-Inkl asking them to enable php error logs for me. I’ll share a log file as soon as I get one.

Could the problems I am having be due to the browser cache? I have been clearing it as I switch between PHP versions thinking it would help. Sometimes it does help but the problems return.

Any move I make in the panel takes about a minute to load. Frustrating.

Kurt

Okay. I received clear instructions from All-Inkl on how to enable PHP error logging. I did so but no errors are being logged (even though some pages are still hanging and loading very slowly when I click through the site). Would that indicate that the problems are not PHP-related? Or maybe I set up the error log thing wrong. I am stumped.

Kurt

@kurtg:
Did you correct all the missing permissions on the file system of your webserver like your screenshot tells?
It may be necessary to repeat this after every FTP upload depending on the configuration of your webserver!

You can easily test if your error logs work by creating an obvious php error.

I checked PHP error logging with an obvious PHP error and it is working.

site/accounts = 0755
thumbs folder = 0755
content folder = 0755
all content sub folders = 0755
all content sub folder files = 0644
assets/avatars = 0755

Am I missing something?

Kurt

Do you use any plugins in your site? If so, try to remove all plugins and check if it works then.