Drupal 5.0
Configuration file Protected
Cron maintenance tasks Last run 3 days 12 hours ago
You can run cron manually.
Database schema Up to date
File system Writable (public download method)
GD library bundled (2.0.28 compatible)
MySQL database 5.0.27
PHP 5.2.0
Unicode library PHP Mbstring Extension
Web server Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0

I initially set up drupal 5.0 for a single site using the default set-up for that. I was bad and just dumped the files directly into the htdocs folder.

Now I'm wanting to set up a test site so I can install modules, and work on customizing the user profiles before I move those changes over to the production site. This means separate databases.

A little confused I forged ahead and admittedly broke my site attempting to follow instructions. Thank god for having mySQL Administrator installed which permitted me to make a back up of the database, reinstall xampp and restore the database and my files.

Root is htdocs

Drupal is in htdocs/drupal

Anyway, now my themes and modules are in sites/all/

My production site is in sites/sheffielduncensored.ath.cx
My dev site is in sites/sevsheffuncen.ath.cx

I then attempting to set up virtualhost, and started with this:

NameVirtualHost *


ServerName sheffielduncensored.ath.cx
DocumentRoot /www/


ServerName devsheffielduncensored.ath.cx
DocumentRoot /www/

Both URLS are giving errors

Fatal error: Call to undefined function user_access() in C:\Program Files\xampp\htdocs\drupal\includes\menu.inc on line 1376

Which refers to the below chunk of code:

/**
* Returns TRUE if the site is off-line for maintenance.
*/
function _menu_site_is_offline() {
// Check if site is set to off-line mode
if (variable_get('site_offline', 0)) {
// Check if the user has administration privileges
if (!user_access('administer site configuration')) {
// Check if this is an attempt to login
if (drupal_get_normal_path($_GET['q']) != 'user') {
return TRUE;
}
}
else {
$offline_message = t('Operating in off-line mode.');
$messages = drupal_set_message();
// Ensure that the off-line message is displayed only once [allowing for page redirects].
if (!isset($messages) || !isset($messages['status']) || !in_array($offline_message, $messages['status'])) {
drupal_set_message($offline_message);
}
}
}
return FALSE;
}

Line #1376 is this line :: if (!user_access('administer site configuration')) {

Why am I thinking putting the site offline while I tinkered with this was a BAD idea.

Checked the DB in dev

changed the offline site variable to that of an online one via mysql on the dev site only.

Then realized that I made a mistake pointing root to the right folder, so corrected that based on someones advice to www/drupal

I then battled with the Bad Request error.

I hopped onto google and searched finding that xampp is a bit picking on how virtual host is set up

I got past that error

I did some research on xampp and the virtual host function.

I found this:
http://www.webmasterworld.com/forum92/3130.htm

I put a copy of that code in with it adjusted to my stuff.

Now I get this error on the dev url I get :

Fatal error: Call to undefined function block_list() in C:\Program Files\xampp\htdocs\drupal\includes\theme.inc on line 1013

Which refers to this code:
/**
* Return a set of blocks available for the current user.
*
* @param $region
* Which set of blocks to retrieve.
* @return
* A string containing the themed blocks for this region.
*/
function theme_blocks($region) {
$output = '';

if ($list = block_list($region)) {
foreach ($list as $key => $block) {
// $key == module_delta
$output .= theme('block', $block);
}
}

// Add any content assigned to this region through drupal_set_content() calls.
$output .= drupal_get_content($region);

return $output;
}

This line in particular " if ($list = block_list($region)) {"

And on the production url I get the same error I had before:
Fatal error: Call to undefined function user_access() in C:\Program Files\xampp\htdocs\drupal\includes\menu.inc on line 1376

Any ideas since I have no clue at this point.

Comments

Miss Essence’s picture

Original posts here:
http://drupal.org/node/53705#comment-191416

Then the gentleman helping me suggested I make a new post seeing as I got to the end of his expertise on the issue.

I think moving to multi=site set up has been a serious pain in the butt for me, and has taken me more than a day to get this far.

cog.rusty’s picture

What is that 'www' in DocumentRoot? Is there such a folder? Try this:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName sheffielduncensored.ath.cx
    DocumentRoot "C:/Program Files/xampp/htdocs/drupal"
</VirtualHost>

<VirtualHost *:80>
    ServerName devsheffielduncensored.ath.cx
    DocumentRoot "C:/Program Files/xampp/htdocs/drupal"
</VirtualHost>

You can replace * with your numeric IP if its is static, and usually you can omit :80 since it is the default.

Actually, using the latest XAMPP, I do not put that directly in 'apache\conf\httpd.conf' but in a separate file 'apache\conf\extra\httpd-vhosts.conf. But it should work ok in 'apache\conf\httpd.conf'.

I assume that you have already set up your domain names to resolve to your own IP (because mine is only local and I make the domain names work only on my computer by using Windows 'hosts' file.)

Miss Essence’s picture

I had corrected that. But errors kept coming up. Patience is not one of my virtues when it comes to fighting with computers. I basically installed the server clean and was waiting for some sort of response to do anything since it just seems this whole multi-site thing is so convoluted.

I, thank god, backed up my DB but even if I try restoring that it gives me an error on line 540... timeout. So. I undid it all out of frustration.

Now I guess I'll plonk drupal in and do the proper file structure.

Modules sites/all
Themes sites/all
Live site sites/sheffielduncensored.ath.cx
Test site sites/devsheffuncen.ath.cx

Also I'm using dyndns for domain names, and I have a dynamic IP that changes maybe every 3 months or so.

Miss Essence’s picture

I went on an Apache friends forum hoping I could get some assistance there.

---
cvdbAdmin wrote:
You might try http://andymelton.net/tutorials/xampp_server.pdf. I haven't actually done this but I have seen it done and andy seems to cover it pretty well. His tutorial is for someone using Linux but you should be able to do the same thing in Windows with no problems. Just make the same changes to the files that he suggests but don't worry about all the command line stuff that he talks about.
---

I followed that letter to letter, except all the command line stuff. I put stuff in the virtual host config in /extras for Apache.
I made a folder in htdocs called live and made an html file (index.html) that says "Live". The said vhost changes are supposed to permit me to access said live folder via http://sheffielduncensored.ath.cx

Instead I get:
"Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
sheffielduncensored.ath.cx
01/23/07 20:14:12
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0 "

When I go to localhost I get:
Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
01/23/07 20:17:00
Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0

Below is the addiction to the vhost conf file

Code:

# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

<VirtualHost *:80>
    ServerAdmin sheffielduncensored@gmail.com
    DocumentRoot "/htdocs/live"
    ServerName sheffielduncensored.ath.cx
    ServerAlias sheffielduncensored.ath.cx
</VirtualHost>
cog.rusty’s picture

Use the *full* Windows path of the drupal installation for DocumentRoot. I guess it is "C:/Program Files/xampp/htdocs/drupal"

Also, a ServerAlias is supposed to be used for a different name, no sense using it for the same ServerName.

Miss Essence’s picture

Like this:

NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

<VirtualHost *:80>
    ServerAdmin sheffielduncensored@gmail.com
    DocumentRoot "E:\server\xampp\htdocs\live"
    ServerName sheffielduncensored.ath.cx
    ServerAlias sheffielduncensored.ath.cx
</VirtualHost>


Miss Essence’s picture

Okay that seems to work despite very long loading time. Now that I can do vhosts properly...

How does the multi-site thing work? :)

so now it's:

htdocs/drupal

I moved modules and themes into sites/all, made a sheffielduncensored.ath.cx folder and put a brand new settings.php in it along with a files and temp folder. I did the same for the devsheffuncen.ath.cx folder. Each of them will have separate databases. I can set up two blank dbs real quick no problem.

I set up a blank database for sheffielduncensored.ath.cx, Blank as in I made a backup of a drupal database right after installing.

Now I'm getting this error:
Fatal error: Call to undefined function block_list() in E:\server\xampp\htdocs\drupal\includes\theme.inc on line 1013

cog.rusty’s picture

function block_list() should be defined in /modules/block/block.module. Is that all the error message says? Anything about paths?

In my case (which works) DocumentRoot would be "E:/server/xampp/htdocs/live", and not "E:\server\xampp\htdocs\live" (yes, in Windows). Not sure if that is important. I have made no other changes anywhere -- just XAMPP's default installation.

I still don't understand why you use sheffielduncensored.ath.cx two times, one as a ServerName and one as a ServerAlias. Also, I don't see where in your vhost you have devsheffuncen.ath.cx

I don't understand what you mean by "Blank as in I made a backup of a drupal database right after installing." Normally you should

- just create a database for each site with phpmyadmin, containing no tables at all. The database's locale should be utf8_general_ci.
- under each /sites/sitename folder put a fresh settings.php without any settings at all
- browse to each site's URL and Drupal's installer will come up and guide you.

------

Edited to add:
About /sites/sitename/files, personally I find it a very bad practice, no matter what the handbook says, because your files and images internal links in your content will be like /sites/sheffielduncensored.ath.cx/files/filename. This is

- a bother when entering an URL in the content and a long and ugly link for the users
- hard to move your site to a different domain (for example from a development domain to a live domain). It can be done with Unix "symlinks" or Windows "junctions", but that would be a convoluted way to correct the result of a bad practice.

/sites' subfolders is an unnatural place for files. A somehow better practice is to use /files/site-nickname/filename where "nickname" is a short name for each site which you wouldn't mind reusing on a different domain.

Miss Essence’s picture

I removed the Alias.

This is what htdocs is right now:

# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    DocumentRoot /www/docs/dummy-host.example.com
##    ServerName dummy-host.example.com
##    ServerAlias www.dummy-host.example.com
##    ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log
##    CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common
##</VirtualHost>

<VirtualHost *:80>
    ServerAdmin sheffielduncensored@gmail.com
    DocumentRoot "E:\server\xampp\htdocs\drupal"
    ServerName sheffielduncensored.ath.cx
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin kristinahall.83@gmail.com
    DocumentRoot "E:\server\xampp\htdocs\drupal"
    ServerName devsheffuncen.ath.cx
</VirtualHost>

----

I put fresh settings.php in each one sheffielduncensored and devsheffuncen.

Also using brand new databases.

Starting with sheffielduncensored.ath.cx

I get error:
Warning: require_once(./modules/system/system.install) [function.require-once]: failed to open stream: No such file or directory in E:\server\xampp\htdocs\drupal\install.php on line 21

Fatal error: require_once() [function.require]: Failed opening required './modules/system/system.install' (include_path='.;E:\server\xampp\php\pear\') in E:\server\xampp\htdocs\drupal\install.php on line 21

Dev Sheffield Uncensored devsheffuncen.ath.cx

Warning: require_once(./modules/system/system.install) [function.require-once]: failed to open stream: No such file or directory in E:\server\xampp\htdocs\drupal\install.php on line 21

Fatal error: require_once() [function.require]: Failed opening required './modules/system/system.install' (include_path='.;E:\server\xampp\php\pear\') in E:\server\xampp\htdocs\drupal\install.php on line 21

As per the handbook:
Modules are in: sites/all/modules
Themes are in: sites/all/themes

Or.. am I better off putting the modules and themes in the drupal root directory as I think that's what the system is complaining about.

Miss Essence’s picture

As a test, I put modules and themes in the drupal folder and removed them from the sites/all folder.

Went to devsheffuncen.ath.cx and ran the install... This works.

cog.rusty’s picture

Oops! I hadn't noticed. Yes, the /sites/all/modules directory is intended only for the contributed modules, so that you can have them all in a different place. The same is true for the themes.

unodewaal’s picture

I had such a mission with this... eventually I figured out that I was missing one line that was commented out:

NameVirtualHost *:80

that's the important one. I'm still trying to configure the multi-sites, but atleast it's mildly working at the moment.