Hi I'm a Drubie (Drupal Newbie) but I've already finished my first site in Drupal on my personal LAMP server, it's for the student union at SFU that I'm involved in. Now I'm in the process of trying to transfer the site to SFU's servers, my Drubieness is getting me stuck and I was wondering if anyone could lend some advice.
This is what the webmaster I spoke to told me about getting Drupal to run on their servers:
the cgi.sfu.ca server currently only supports "CGI" mode. Drupal is written to expect a server using the "mod_php" module for the web server: that means that you have to do some digging around in Drupal (and similar applications) to add the line "#!/usr/local/bin/php" to the start of most of the .php files that ship with Drupal in order to make them executable. If you've not done this before: it can be a bit tricky because it's only the directly executable files in Drupal that would need to have that line added. If you add that line to say, an included module, then you'll see that line displayed on the page, probably multiple times. If you're not really familiar with the application you're installing, this can be a bit of a slow process.
The general help pages on getting php scripts to run on SFU servers told me that php scripts should be chmoded to 700 as to not allow anyone to see the script. I'm not sure what permissions are needed to get Drupal up and running and as it sits I keep getting an internal server error (I assume there's an issue with the php script running properly) when I go to index.php.
It also stated on the general info page that php scripts needed to end in .php (or a variant of such as .php4) so I went as far as to create a version of Drupal with all the .inc .module .profile etc... changed to .inc.php .module.php and .profile.php and did a find/replace on all files to accommodate for this requirement. Sadly this didn't end up working. Don't know if I was on the right track or not...
Can anyone help?
Comments
you shouldn't need to rename
you shouldn't need to rename the inc and profile and such.
afaik there are 3 entry points for drupal.
index.php
upgrade(or update?).php
install.php
once you install you don't need install.php
so really you only need your #php line on index.php
I found the sfu servers very hard to work with in the past, if you don't have your files setup just right it spits out alot of errors.
is your index.php chmod'd to 700?
Okay, I thought the renaming
Okay, I thought the renaming was a little overkill.
I do have my index.php (and the other) files you mentioned chmod'd to 700. I've noticed that if .htaccess is left as it is I get a 403 Forbidden error, whereas if it's given read permissions I get the 500 Internal Server Error.
Do I need to give executable and unreadable permissions (700) to all .inc .module etc... ?
Also, cron.php.
Also, cron.php.
settings.php configuration settings
I don't know if this will work for all .inc files, but at the very least for cache.inc, you can specify where an 'alternate' file is.
$conf = array(
'cache_inc' =>
'includes.cache.php'
);
Does it work for the other .inc files? That is, would the following work?
$conf = array(
'cache_inc' => 'includes/cache.php',
'bootstrap_inc' => 'includes/bootstrap.php'
);
Not needed for includes
As Gavin said, only index, upgrade, install, and cron.php are directly executed, everything else is included as needed.
And -- ouch! -- those servers sound slow and painful to work with. Running PHP as a CGI is the absolutely slowest way to run it.
Let us know how far you get....
Well I've tried with the
Well I've tried with the executable php files chmod'd propperly (700) and everything else stock.
Here's a little more info: I'm trying to run Drupal 6.1
The instructions on getting php to run is given here: http://www.sfu.ca/itservices/sfuwebhelp/php.htm (I have double checked and the endline characters on the transferred files are in place).
I've re-emailed the sfu webmaster asking for further help, but I'm not holding my breath.
Okay, it's running Drupal
Okay, it's running Drupal now, though without any formatting or theme styling (edit: just realized that this has to do with permissions on the css files etc). And after clicking 'Install Drupal in English' I get this error:
Not only does the PHP site it points to talk about changing apache configurations (which I can't do to the SFU servers), it doesn't seem to have any advice on register_globals.
Now I've seen a glimmer of hope... any advice?
If you are just going to
If you are just going to copy over your previously installed site you can skip running the install script and just skip right to importing the db. I believe the only time you are stopped for having register_globals enabled is during the install script.
If you need to use the install script it looks like you can just alter the if statement at modules/system/system.install line 54 to always be false. I haven't done this before but it looks like that alteration should work.
Of course there is the caveat that you will have the security issue of having register_global enabled, but I'm not sure if this is something to be seriously concerned with; especially since I believe this requirement is new to 6.
Good luck,
Steven
MySQL install issue
Okay, so now when I attempt to connect to the MySQL database that SFU has setup for me it doesn't want to connect. I'm pretty sure that I've tracked it down to line 42-52 of the install.mysql.inc file not specifying the database name in the connection attempt, but waiting until after a connection is made to mysql. So is it possible to merely adjust the install script to call the specific database, or is Drupal regularly going to attempt to connect to mysql this way?
Edit: scratch that, turns out that's the proper way things should be done and once again my Drubieness is getting me confuzzled. But at least I'm learning.
Can't reach mysql
So I'm stuck at the install script's attempts to reach mysql on sfu servers. I've filled in all the appropriate info and the code in install.mysql.inc looks like it should work, but still it tells me:
Failed to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2).
I've been able to connect to the mysql database directly through the command line via ssh on the server, and when I tried a script that the mysql admin gave me, it was able to connect, but Drupal still isn't able to.
Edit:
After running a few echo commands, it turns out that Drupal isn't changing the localhost section of $url in the mysql://username:password@localhost/databasename url. I need it to read 0 rather than localhost. How can I fix this?
I tried manually forcing it in both install.mysql.inc and database.mysql.inc by changing $url['host'] = urldecode($url['host']); to $url['host'] = 0; but it returned a parsing error claiming that the header cannot be changed. Dirty hacks are dangerous anyway.
So what gives, why does it stay as localhost? I've entered 0 in the form; shouldn't that be enough?
Umm....
don't edit any of the inc files. That's all controlled and documented in the settings.php file that D6 should have helped you generate....
Localhost == the local host machine, not sure why you're trying to set it to zero?
The SFU MySQL server
The SFU MySQL server requires it to be set to zero rather than localhost - part of their "robust" installation. I've tried it with localhost in the script that the admins sent me and I get the same
Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) message.
Edit:
I just went into default.profile.php and changed the db_url to be a 0 rather than localhost, went through the form (entering 0 as the database host) and still, the host shows up as localhost in the hidden url.
what about forcing it to localhost ip?
you might try replacing localhost with the (loopback) localhost ip 127.0.0.1?
does your mysql user have the right permissions to connect from localhost? If you were able to get there from the command line it would seem that it does, maybe mysql is not resolving the localhost name and IP would fool it....
you might try doing a grant (GRANT ALL on 'databasename'.* TO 'username'@'localhost' IDENTIFIED BY 'password they gave you'
you can replace 'localhost' with the wildcard % to allow connection from any host, but thats not very secure.
this sounds pretty weird, can you ask the IT folks for a pointer? Good luck with it
Old MySQL
YAY! 127.0.0.1 works!
but now I get the error message that the MySQL system is too old. Is there an older version of Drupal that will run on MySQL 4.0.20? I know other sites on SFU are running drupal so it should be possible.
Edit: duh, that info is available on drupal's website. Off I go to try with 5.7... wish me luck - with these servers I think I'll need it!
Thank you
So it turns out that the SFU servers require an older, outdated, and heavily modified version of luck. After phoning my grandfather, borrowing his, then changing its settings and permissions to look like mine, Drupal finally is up and running. Thanks to everyone who lent advice, I'm quite grateful.
Sounds like you're there!
Congrats...
I've been following your thread with interest but you seem to have everything well in hand now... The troubles you've encountered are no doubt a result of the security task force's stellar and robust server environment. register_globals enabled is in chapter one of the "how to secure your PHP distro". (NOT)
You will no doubt find that your next install is surprisingly simpler.