I've recently set up a VPS server using 123-reg.co.uk
I have a number of sites to transfer to it that use Wordpress as a CMS service.
I 'include' worpress as follows:
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'.
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.
Further information:
Wordpress is installed in a folder /blog/ It's included as follows:
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.
wp-blog-header.php calls '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).
Any ideas ?
EDIT: Apache error logs:
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
假设您在浏览器中访问的页面比安装Wordpress的blog
目录高一层,请尝试:
require(dirname(__FILE__) . '/blog/wp-blog-header.php');
只需要在命令下运行然后它对我有用
a2enmod php7.2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.