• Resolved ChrisLowrance

    (@chrislowrance)


    Hi!

    I’ve seen this basic question asked before, but never answered.

    I need to call WordPress-generated content on an external, non-Wordpress site. I’ve read the Codex entry on this backwards and forwards, and have added <?php require('/the/path/to/my/wp-blog-header.php'); ?> to the header of the external page I want to embed WordPress content on.

    Unfortunately, this immediately generates the famous “Error Connecting to Database” page. The thing is, my wp-config file is fine: In fact, the WordPress site itself loads fine. The database error only happens on the external page. I suspect there is some conflict happening between WordPress and the system powering the external site (the external pages are generated by a proprietary system using Smarty, with its own database. I didn’t make it and have little control over it).

    Any ideas about what would cause this? If I can’t work it out, I’m going to be stuck calling the WordPress content in an iframe, which is extremely suboptimal.

    Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Is this site in the same server/domain as your WordPress site?

    Thread Starter ChrisLowrance

    (@chrislowrance)

    Esmi: Yes. I’ve also tried moving the WordPress installation into a sub-directory of the external site’s root directory, without luck.

    So both sites uses the same domain name, yes? Have you checked with your hosts to see if they have are blocking access to the database?

    Thread Starter ChrisLowrance

    (@chrislowrance)

    Esmi: Both sites use the same domain name. I’ve sent a request to the host now. It seems odd to me that they might block access to the database from within the same domain, but I’m no expert. Is this something I’d be able to check myself, either through DirectAdmin, PHPmyAdmin, or SSH access?

    I have known hosts sandbox databases to prevent external access but that’s normally where “external” refers to another domain or server. The only other possibility is that Smarty is causing an issue connecting with the WP database.

    Thread Starter ChrisLowrance

    (@chrislowrance)

    I don’t think that’s what’s happening here: I just tried including wp-blog-header on a few other external pages on the same domain (other WordPress installs, and also just plain PHP files), and it doesn’t have a problem with that.

    I suspect it is Smarty or something else with that system. I think I’ll go bug their community about it a bit. ?? Thanks!

    Thread Starter ChrisLowrance

    (@chrislowrance)

    Best I can tell, there’s no reason Smarty should get in the way, which leaves the proprietary, closed-source system. Looks like I won’t be solving this one. Thanks for your help, regardless.

    Sorry we couldn’t help more. ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘wp-blog-header.php on external page results in database error’ is closed to new replies.