I am facing a redirect to wp-admin/install.php page
What i m doing is, i have wordpress installed in /blog folder under public_html, that is wordpress is the blog for my main site. i will post updates and news about various events in the blog. And i want to show 5 latest blog post on our site homepage.
To do this i have made a php include file "latest_blog_posts.inc.php"
With the following test code --
<?php define('WP_USE_THEMES', false); require('c:/wamp/www/onlyfreelancer/blog/wp-blog-header.php'); ?> <?php query_posts('showposts=5'); ?> <?php while (have_posts()) : the_post(); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a><br /> <?php endwhile;?>
Now when i load the inc page directly in browser it shows the posts ok. But when i include it in my site's homepage it redirects me to the install.php page
Upon check i have found that the sql query to fetch siteurl value in is_blog_installed() function evaluates to this -
SELECT option_value FROM options WHERE option_name = 'siteurl'
That is instead of being "wp_options" it is simply "options", missing the prefix. For this the siteurl value can't be fetched and wordpress calculates that its not installed.
How to fix this? This problem only occurs when i include the inc to my site's home page. or any other page. It works when its loaded directly in the browser.