We help IT Professionals succeed at work.

My client's homepage changed massively, are these PHP errors related?

Mike Morgan
Mike Morgan asked
on
Hi,

I was customising a banner on my client's homepage around a week ago, very basic additional CSS on a qode wordpress theme to get the banner looking the way I wanted, achieved that, saved my work and closed my laptop down.

When I got home a short while later, I visited her site on Firefox and the homepage was a mess! Her logo was gone and the theme logo was in its place, the buttons on her homepage had lost all their styling, the banner I was impressed with looked awful and not like the final version I saved, the footer columns widget content had all shifted out of alignment to the left as well as various other styling issues.

I know this is clearly CSS related but error logs are referencing PHP issues, nothing mentioned about CSS and PHP is something I know absolutely nothing about. I've copied and pasted some of the errors and spent some time trying to figure out what they mean but her site has been like this for too long now for me to learn enough PHP to understand these errors and determine whether they could be related to my issue.

Out of desperation, I deleted my theme and reinstalled as I had similar issues following a major update recently and hoped following those steps might solve the problem this time, but no luck.

If anyone has the time and understanding of PHP to scan through my error codes and tell me whether or not this could be related to the problems I've had I would be extremely grateful...

The PHP version is: 5.6.30, Wordpress 5.1.1, the theme is qode bridge version 18.0.8 and these are the latest logs.

https://sabercathost.com/folder/116767/Documents

The logs are lengthy and look fairly repetitive so I've uploaded them in TXT format rather than pasting here, not sure if that breaks any rules as I'm a newbie to this site.

Thanks in advance to anyone that takes a look...
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
First up welcome to EE - I see this is your first question.

Secondly, WP sites tend to generate loads of PHP errors by default - it is possible the PHP errors you are seeing in the logs are recurring issues from before the change - you should check to see if the errors that occurred after the change were not also appearing before the change.
You don't want to be chasing red herrings.

I had a look at the logs but it would help if you have an exact date time for the issue.

Also do you have a link to the site?
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Likely also best to enable WP_DEBUG + provide a copy of your debug.log files.

Also, be sure to provide your site URL, as Julian suggested.

Author

Commented:
Hi Julian,

Thanks for the welcome and reply.

Good point and yes, the error on the log titled March-April on line 64 was definitely occuring before I made the changes because I added that custom CSS around the 1st or 2nd of April.

The site is here Toots Trinkets

Even with my zero knowledge of PHP, I assumed it had to be a CSS error but nothing referecing CSS has appeared on any error logs, only PHP issues, and although I'm manually changing the styling back, it's bugged me why it happened in the first place.

Author

Commented:
Hi David, thanks for your contribution.

I did actually enable debugging a few days ago but can't find a log for it. I've looked in the content directory as well as searching all files and nothing, no log...

I then added a debug plugin which, when I run it, just shows a zero as the result.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Finally got a copy of your logs from sabercathost (super slow)...

The first line of your debug file shows...

[14-Feb-2018 22:35:21 UTC] PHP Parse error:  syntax error, unexpected end of file, expecting ')' in /home/mikeadvance/public_html/tootstrinkets/blog/wp-includes/admin-bar.php on line 627

Open in new window


This seems to show up for WordPress core version + PHP version mismatches.

WordPress show minimum requirements PHP-5.6 is still supported, so unsure why this is showing up.

Maybe put up a phpinfo.php file on your site + post your site URL for testing.

Note: Best to update your Bridge theme, as I recall the current warning prompts/raises to a PHP Fatal in more recent PHP versions, so your site will likely crash if you update PHP. Best always keep your WordPress core + theme + plugins updated.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Looks like errors on your system are emitting to the Apache error log file you posted.

Author

Commented:
Apologies, I've never used sabercathost until now either, but the logs seemed too long to post here.

The theme is updated and, according to qode, this was a major update to ensure they're inline with their vendor's requirements (Themeforest). In actual fact, I had similar problems to this after installing the update but compared with what some people were reporting, I got off quite lightly, I think.  That was my reason for trying a resintall again on this occasion, because the problems are quite similar.

Not sure what you mean by put up a phpinfo.php file so bear with me while I find out what that means and how to do it.

Actually, I'm not sure if you noticed but, at the bottom of the second log there's a reference to something called 'site.ru' which some Googling uncovered a lot of suggestions of a hacked site, do you think there's anythinhg I should look into there or is that just over-exaggerating the problem?

Author

Commented:
Ok, done that, David...should I share the link or should that be sent in private message?

Author

Commented:
Odd, it's showing PHP Version 7.1.27 at the top of the page whereas PHPmyadmin is showing version 5.6.30
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
but nothing referecing CSS has appeared on any error logs, only PHP issues
CSS issues won't show up in the log.

Here is how it works. WP is written in PHP which runs on the server. The various WP PHP scripts output HTML which is sent to the browser.

The browser then renders the page.

Any issues with CSS are going to be the browsers domain - but CSS errors are not really reported (you can pick them up through a validation tool). This is more a case of the CSS not being correct - or not being sent as part of the page (either as a link or inline).

If I look at the link you posted - but I don't know what I am looking for. Having not seen the site before the change - what is it that is not looking the way it should and do you have some sort of representation of what it should look like?

Author

Commented:
Actually, I've been manually changing the styling back again so it's not a million miles away from where is was now but it was the fonts, the coloured banner I created has changed font, the button colours and shape have changed, the three columns at the bottom of the page with the quick links, logo and Facebook feed have shifted over to the left.

So, yeah, definitely all CSS related but you've just educated me on the way CSS loads so I wasn't aware that errors wouldn't show on a log. Like I said, I know nothing about PHP so after seeing the long list of errors, I assumed it had stopped part of the CSS loading somehow. A lot of assumptions on my part, I think...

It was just the fact that such minor custom CSS changes were made prior to everything going askew that bugged me, I didn't see anything that would have caused what happened. But I do use a number of plugins and generally any problem I have is plugin related somehow...

Also, if you add anything random to the end of the URL to bring up a 404 page, there's a couple of PHP error messages at the top of the page. Not sure where they've come from...
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Might be best to PM me your phpinfo link.

Note: You're covering a lot of ground in this question. Likely better to focus on one item per question, for best answers.

Note: Your original question referred to CSS errors. You'll find CSS errors using a validator like https://jigsaw.w3.org/css-validator/ or similar.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Tip: If you update your Bridge theme, likely your log will dramatically shrink in size.

Author

Commented:
Thanks for the advice, David. I didn't mean for the question to be so broad but on the plus side this has been a bit of an education already.

There are no further updates available for Bridge, that last major one was the most recent, 18.0.8

I'll send the link now.

Thanks again for your time on this!
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Bridge: I'd open a bug report about the cruft output into the debug.log as this Warning will likely become a Fatal in future PHP versions.

PHP: Web version is 7.1.27 + if your CLI version returns a different version, this just means CLI version either requires updating or php CLI path requires an update, which might be why phpMyAdmin returns the wrong version.

Site: Currently site banner looks well styled.

404s: If you add anything random to a URL, then you should get a 404... because... random strings on the end of URLs generate 404s...
Terry WoodsWeb Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
I would be hesitant to upgrade the theme to try to fix the issue. Theme upgrades often introduce new problems, and blending a new set of problems with an existing problem can blur the situation and make things harder to solve.

Do you have backups of your site that you can go back to if needed?

To enable PHP error logging, I find the easiest way is to add the following to the top of my wp-config.php file, after the initial comments:

@ini_set('log_errors','On'); // enable or disable php error logging (use 'On' or 'Off')
@ini_set('display_errors','Off'); // enable or disable public display of errors (use 'On' or 'Off')
@ini_set('error_log',__DIR__.'/error_log'); // write errors to base WordPress directory

Open in new window

That should create an "error_log" file in the root of the folder that WordPress runs from, if there are any PHP errors.
Terry WoodsWeb Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
Sometimes when you change/upgrade the theme, you need to go into the theme options and click Save (sometimes you need to make a minor change to enable the save button, which you can revert after saving). I've also seen some instances saying you should go into the Settings > General page and click Save there.

That can be all it takes to fix such an issue, if the theme has been upgraded/downgraded/changed.
Terry WoodsWeb Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
Keep in mind that your browser will sometimes cache CSS. If you aren't seeing changes on the site that you expect, force a refresh of your browser (ctrl-F5 on a PC).  There can also be caching software in WordPress, from a theme or plugin. Generally if it's present, there is an option in the top bar of the Dashboard to clear the cache. You may also need to do this before changes become visible on the site.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Generally Terry is correct. Updating any code to fix problems can create additional problems.

In your case, the PHPINFO link you PM'ed me shows somehow your PHP version has updated to 7.1.27 so this is why I suggested you ensure Bridge was updated. Also you mentioned you're running latest Bridge, so the theme can likely be ruled out as the problem source.

Terry's suggestion reminded me of something else you should check. Your Opcache settings, if Opcache is being used. Most PHP 7.X installs enable Opcache by default.

If Opcache is set to never expire complied code, then nothing you do will fix this problem, as the PHP code producing the error will be cached forever.

Till you resolve this problem, ensure...

opcache.enable = 0

Open in new window


This will be in your php.ini file or your opcache.ini file, depending on how your version of PHP was installed.

Author

Commented:
Hi,

Thanks for contributing, Terry.

First, David, I need to decipher some of the terminology in your reply from 3 days ago in the comments on bridge and PHP. I'm not familiar with some of what you've mentioned so bear with me while I get to grips with that, but thanks for the advice.

Regarding the 404 thing, I don't think I explained properly. I meant, if you add something to the URL to intentionally to get a 404 like you said, then at the top of the page below the address bar, there are a couple of rows of code visible for some reason. Probably unrelated but just something I'd  never noticed before.

In hindsight, reinstalling the theme was a bit of a knee-jerk reaction but really, the site looked awful and I was desperate to get it looking half straight, at least, before my client saw it. But noted for future reference and, yeah, what you've said about making it harder to find the source of the original problem makes sense. I tried the general options and save suggestion when I reinstalled because I had to do that when I originally installed this update and it solved the issued then....but not this time.

I think I've been a bit naive until now with debugging because I've never had any problems where debugging has been needed with any site up to now. Another lesson learnt :)

I don't have backups as such but I'm able to revert a page back to the way it was prior to making a change through wordpress but even that wasn't taking it back to exactly where it was. There  were problems that just weren't disappearing despite reverting to a stage before they were there.

I was wondering whether it's a plugin that's caused it because I use a couple for minification as well as adding CSS and JS and perhaps they weren't compatible with this lates theme update? I'm not sure how to determine that, especially as I've already started manually repositioning the elements and restyling the text etc.

Anyway, I'll go through all of the suggestions one at a time and see what comes up. Maybe this is my opportunity to learn some of the PHP I've been lazily trying to avoid.
Terry WoodsWeb Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
It's absolutely critical for running a reliable website that you keep backups (keep at least an occasional one remotely, off the web server too), as malware can modify/delete your files if your site gets compromised.

I use managewp.com (with the free ManageWP Worker plugin) to keep remote incremental backups of my websites. It's not too difficult to set up and is either free (or very cheap, if you need to use the Premium tools). Let me know if you want any help with setting it up. There's other options too, but the ones I've tried I've found to be less reliable or less useful.

When you install new themes or plugins, they can modify your WordPress database. If the author of the code makes a boo boo, you don't want the only copy of your database permanently damaged or corrupted. As mentioned, backups are of critical importance, if you value your site.

It's often a good idea to turn off any minification and caching plugins while doing maintenance/troubleshooting on your site, as it can make it more difficult to track down problems.
Terry WoodsWeb Developer, specialising in WordPress
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
Ok, I see that when I view URL:
https://www.tootstrinkets.co.uk/foo
I get the following notices:
Notice: Trying to get property of non-object in /home/dc9ryehab7d8/public_html/wp-content/plugins/fb-comment-share-for-woocommerce/frontend/fbc-class-frontend.php on line 107

Notice: Trying to get property of non-object in /home/dc9ryehab7d8/public_html/wp-content/plugins/fb-comment-share-for-woocommerce/frontend/fbc-class-frontend.php on line 108

Open in new window

That says to me that your PHP display errors setting is turned on (it shouldn't be, because it leaks information to potential hackers). This line of the code I posted for adding to your wp-config.php file is an attempt to turn it off:
@ini_set('display_errors','Off'); // enable or disable public display of errors (use 'On' or 'Off')

Open in new window


Do you have cPanel for your web server? If so, you may also be able to turn that option off in the Select PHP Version > PHP Options tool.

Anyway, the notice is clearly coming from the plugin with folder fb-comment-share-for-woocommerce which probably goes by a similar descriptive name. A notice in itself shouldn't break the site, so it may be a red herring that's unrelated to the issue you're seeing.
David FavorFractional CTO
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
As Terry said, the fb-comment-share-for-woocommerce plugin won't break your site today, based on your current PHP version.

Keep in mind, over time PHP promotes/escalates notices to fatals, where coding problems can't produce sensible behavior.

Trying to get property of non-object is one of these cases, as trying to operate on some value returned in this case can never occur.

Open a support ticket with the developer to fix this problem, as leaving this problem as-is will likely cause your site to crash (500 Internal Error) at some point in the future, when you or your hosting company upgrades PHP.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.