Error 500 after hosting restore

I could use some help troubleshooting a site.

My client lost their hosting account (credit card mix up). After a some time they were able to get their host to restore their account–database and files. I’ve verfied the the database and pw are valid, db looks ok at quick glance.

The domain has been updated to point to the new IP address but I’m getting 500 error when I try to view the front or backend.

I’ve renamed the .htaccess so that’s not in play. This is an older site so I’m thinking that php 7.3 isn’t the issue (for now).

I don’t know what else to check.

This is in the error in the log.

[08-Jul-2022 10:06:17 America/Boise] PHP Warning:  include_once(/home2/xxxxxxxx/public_html/core/xpdo/om/mysqli/xpdodriver.class.php): failed to open stream: No such file or directory in /home2/xxxxxxxx/public_html/core/xpdo/xpdo.class.php on line 1881
[08-Jul-2022 10:06:17 America/Boise] PHP Warning:  include_once(): Failed opening '/home2/xxxxxxxx/public_html/core/xpdo/om/mysqli/xpdodriver.class.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home2/xxxxxxxx/public_html/core/xpdo/xpdo.class.php on line 1881
[08-Jul-2022 10:06:17 America/Boise] PHP Warning:  Creating default object from empty value in /home2/xxxxxxxx/public_html/core/model/modx/modx.class.php on line 2423
[08-Jul-2022 10:06:17 America/Boise] PHP Fatal error:  Uncaught Error: Call to undefined method stdClass::validate() in /home2/xxxxxxxx/public_html/core/model/modx/modx.class.php:2424
Stack trace:
#0 /home2/xxxxxxxx/public_html/core/model/modx/modx.class.php(556): modX->_initContext('web', false, NULL)
#1 /home2/xxxxxxxx/public_html/index.php(50): modX->initialize('web')
#2 {main}
  thrown in /home2/xxxxxxxx/public_html/core/model/modx/modx.class.php on line 2424

Hi @terrybarth

What version of MODX is it?

Hi @terrybarth Have you checked that the complaining resource (core/xpdo/om/mysqli/xpdodriver.class.php) actually exists? also make sure you have the rigth permissions for the core folders

Thanks for the quick response you guys!

Modx version 2.7.3

The file does exist.
Permission on all the core folders is 755
Permission on the file is 644. I compared this to another site I have and this is consistent.

New information:

If I go to the site with either of these I get server 500

www.domain.com
http://www.domain.com

If go to the site with this, I get 404
https://www.domain.com

I take it the rest of the path [aside from the redaction] all looks correct?

Do all paths and other settings look OK in core/config/config.inc.php ?

Yes, I checked the various config files they all looked good to me.

Do you think a reinstall over the top would fix things up?

That’s usually something that helps, just remember to keep a backup

Make sure the base href tag in all templates has an exclamation point. You’ll have to look in the DB see, and edit the tags if necessary.

Another thing to check is the RewriteBase in .htaccess, especially if the site has moved to a subdirectory.

Make sure the host hasn’t changed the PHP version without telling you.

Look for an index.html file in the root directory, and rename it if you find it.

Make sure the files are in the right place (with manager, core, modx index.php, and assets all under the server root.

Checking the modx error log file (core/cache/logs/errror.log) and the server error log may also provide some clues.

Another thing to try: download that version of MODX, restore the setup directory and run setup.

Hey Bob

  • I don’t have any way of know if the host changed the php version and I doubt they would tell me if even they could tell.
  • The base did not have an !. I added it. No change.
  • The .htaccess is out of the picture
  • No index.html (one of the first things I checked)
  • While I didn’t do a file by file check, the main folder are in the right place.
  • The error in the log is in my first post. All files are present.

New information:

I just manually cleared the cache (don’t why I didn’t think of that before, rookie mistake). Now I get the modx error: Site temporarily unavailable.

I uploaded and ran the setup for this version. On the first panel, where you choose the languge, there is a text message above it all that says:

Deprecated : Array and string offset access syntax with curly braces is deprecated in /home2/xxxxxxxx/public_html/setup/includes/parser/modinstallsmarty.class.php on line 75

Is it safe to run the setup with this error?

So I found another post in the community that says this error is just a warning so I proceeded with the setup and got this error and was unable to continue.

**Deprecated** : Array and string offset access syntax with curly braces is deprecated in **/home2/normand1/public_html/setup/includes/parser/modinstallsmarty.class.php** on line **75**

**Warning** : Cannot modify header information - headers already sent by (output started at /home2/xxxxxxxx/public_html/setup/includes/parser/modinstallsmarty.class.php:75) in **/home2/xxxxxxx/public_html/setup/includes/request/modinstallrequest.class.php** on line **234**

You should be able to see the PHP version in cPanel. If not, you can create an info.php file with just this content and view it in your browser:

<?php
phpinfo();

I wonder if the issue is the ownership of the file or directory that’s there but not found. It’s very odd that it’s finding the MODX and xPDO class files, but not that one.

Bob

I know the php version is 7.3. I just don’t know if they changed it from prior to the restore.

I don’t know how to track down a permission error. I think clearing the cache fixed the original error about a missing file (see a couple post back).

Any suggestions on how to get past the setup errors? Cannot modify header information - already sent …

Well I got one step further into the setup routine by changing the url from www.domain.com to https://www.domain.com.

Now I’m getting these errors.

Would be dur to some permissions issues? Do you think I should do a full install over the top vs just setup? Would this resolve any permission problems?

**Warning** : require_once(/home2/xxxxxxx/public_html/setup/includes/drivers/modinstalldriver_mysqli.class.php): failed to open stream: No such file or directory in **/home2/xxxxxxx/public_html/setup/includes/modinstall.class.php** on line **80**

**Fatal error** : require_once(): Failed opening required '/home2/xxxxxxx/public_html/setup/includes/drivers/modinstalldriver_mysqli.class.php' (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in **/home2/xxxxxxx/public_html/setup/includes/modinstall.class.php** on line **80**

Please check your core/config/config.inc.php file closely - I think there may be a config variable set to “mysqli” instead of “mysql”. Note the i at the end. Look in the variables at the top of the file.

That might be something the host “conveniently fixed” as part of the restore (as mysqli was the replacement for mysql; but xPDO uses PDO and not mysqli).

2 Likes

OMG! That was it. Thank you!

Great catch. I am curious though, how would this file have been edited? Wouldn’t the host have to edit it manually? How would they even know about this file?

1 Like

I suspect it’s an automated “fix” as part of the restore. The PHP MySQL functions (e.g. mysql_query()) have been removed, which in most cases could easily be fixed by replacing it with the MySQLI functions (e.g. mysqli_query()). So if they’re restoring and something doesn’t work, they may have some script running to replace mysql with mysqli across a code-base.

But, that doesn’t account for accessing MySQL via PDO, which uses mysql for the driver type/DSN, so they broke that.

If you haven’t done it yet, it’s worth doing an “upgrade” to the same version to make sure nothing else in any of the other files was “fixed” the same way.

Mark Thank you so much. I will upgrade the site, it’s way behind anyway.

Also, make sure your .htaccess file has the section that forces www. or non-www. URLs uncommented, otherwise you’re likely to have more permission problems.

Thanks Bob. I’m good to go on that.

Site has been completely restored and upgraded. Whew!

2 Likes

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.