简体   繁体   English

网站根文件夹 - PHP - Wordpress

[英]Website root folder - PHP - Wordpress

I've recently set up a VPS server using 123-reg.co.uk 我最近使用123-reg.co.uk建立了一个VPS服务器

I have a number of sites to transfer to it that use Wordpress as a CMS service. 我有许多网站要转移到它使用Wordpress作为CMS服务。

I 'include' worpress as follows: 我'包括'worpress如下:

require('/blog/wp-blog-header.php');

Which gives me access to predefined wordpress methods such as get_page_by_title( 'home' ) which retrieves the page named 'home'. 这使我可以访问预定义的wordpress方法,例如get_page_by_title('home') ,它检索名为'home'的页面。

Here's the issue, it looks like wordpress relies on an absolute path to further include the files it needs and I'm struggling to get it working. 这就是问题所在,看起来wordpress依赖于绝对路径来进一步包含它需要的文件,而我正努力让它运转起来。

Further information: 更多信息:

Wordpress is installed in a folder /blog/ It's included as follows: Wordpress安装在一个文件夹/博客/它包含如下:

define('PROJECT_ROOT', getcwd());
include PROJECT_ROOT . "/includes/header1.php";

which calls 哪个叫

include_once PROJECT_ROOT . "/includes/config.php";
require(PROJECT_ROOT .  '/blog/wp-blog-header.php');

The config PHP works fine as does the initial wordpress include. 配置PHP工作正常, 最初的 wordpress包括。

wp-blog-header.php calls 'require_once( dirname( FILE ) . '/wp-load.php' );' wp-blog-header.php调用'require_once(dirname( FILE )。'/ wp-load.php');'

Which seems to go to '/var/www/vhosts/websitename.co.uk/httpdocs/blog/wp-load.php' which looks right but which causes the site to fail with a generic error (500 internal server error). 这似乎转到'/var/www/vhosts/websitename.co.uk/httpdocs/blog/wp-load.php'看起来正确但导致网站失败并出现一般错误(500内部服务器错误)。

Any ideas ? 有任何想法吗 ?

EDIT: Apache error logs: 编辑:Apache错误日志:

2016-08-16 17:57:04 Warning 86.182.179.139      mod_fcgid: read data timeout in 45 seconds              Apache error
2016-08-16 17:57:04 Error   86.182.179.139      Premature end of script headers: index.php              Apache error

As requested by @gentlemanmax 按照@gentlemanmax的要求

假设您在浏览器中访问的页面比安装Wordpress的blog目录高一层,请尝试:

require(dirname(__FILE__) . '/blog/wp-blog-header.php');

只需要在命令下运行然后它对我有用

a2enmod php7.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM