cancel
Showing results for 
Search instead for 
Did you mean: 

Wordpress - I give up

btbonline
Dabbler
Posts: 19
Registered: ‎25-11-2007

Wordpress - I give up

I run three WP sites with Hostgator that were a cinch to install and are dead easy to maintain, I can't even get started here.  I used to have a static html site and wanted to convert this to a WP site on CCGI.  Changed the DNS over, got it working briefly and then recently had to upgrade it to WP 3.01.  That's it - site gone - 403 error.  Everything seems to have changed re advice on scripts, permissions, .htaccess etc - is this a conspiracy by Plusnet to discourage as many of their customers as possible from hosting their own websites to save on infrastructure costs?  if so, it's working like a charm in my case - don't get me wrong I am very happy with PN as an ISP but as  web host - don't go there.
8 REPLIES 8
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: Wordpress - I give up

Presumably the update to WP 3.1 was done using the updater? Did you run the permissions script after applying the update to reset file and directory permissions to the correct ones for ccgi?
It it also necessary to reset permissions after updating plug-ins.
Upgrading was faultless for me, just reset permissions (in a separate tab) before returning to the dashboard.
David
btbonline
Dabbler
Posts: 19
Registered: ‎25-11-2007

Re: Wordpress - I give up

The fact that there is a permission script that I need to run is rather the point.  I see several such scripts in the forums across various threads but have no idea which one I should use - less still what they do!  All this seems to be advice helpfully provided by PN users who appear to be left to fend for themselves where CGI and Wordpress are concerned.  I upgraded to 3.1 from within WP and the site instantly went off line - I have no idea how to access it now - all I get is a 403 error.  I can see the files in CutFTP where my overriding temptation is simply to delete the lot thanks to my considerable frustration with this entire process - which is aimed squarely at the PlusNet service in this respect and not at the PN user community who do a fantastic job.
Thanks for taking the time out to respond.
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: Wordpress - I give up

Almost certainly the problem is related to file permissions which need to be set as described in the new ccgi FAQ here. Item 7 explains the likely cause of 403 errors (incorrect file permissions). Permissions can be changed using FTP, or alternatively using the script below.
If you upload the following setwpperms.cgi script to your WordPress directory, set its permissions to 700 and run it in your browser it should reset WordPress executable file and directory permissions to the correct ones. The script assumes the user has *not* customised WordPress to use a different directory for uploaded image content.
The version upgrade requires WordPress to upgrade its MySQL tables which might require admin login to the WordPress dashboard to make the site fully functional.
[code=setwpperms.cgi]
#!/bin/bash
if [ "$1" != "noheader" ] ; then echo -e "Content-type: text/html\n\n" ; fi
function makeadir ()
{ if [ ! -e "$1" ] ; then mkdir -m 750 "$1" ; fi }
find . -name wp-content -prune -print | while read wpcdir ; do makeadir "$wpcdir/uploads" ; done
find . -type d ! \( -perm 1710 -o -regextype posix-extended -regex '.+/uploads($|/.*)' \) -print0 | xargs -0 chmod 710
find . -type d -regextype posix-extended -regex '.+/uploads($|/.*)' -print0 | xargs -0 chmod 750
find . -type f -regextype posix-extended -regex '.*\.(php|pl|cgi)$' -print0 | xargs -0 chmod 700
echo "<table border='1' cellpadding='2' cellspacing='1'>"
echo "<tr><th>Type</th><th>Name</th><th>User, Group</th><th>Permissions</th></tr>"
find . -type d -printf '<tr><td>Folder</td><td>%p</td><td>%u, %g</td><td>%M</td></tr>\n'
find . -type f -printf '<tr><td>File</td><td>%p</td><td>%u, %g</td><td>%M</td></tr>\n'
echo "</table>"[/code]
After an automated WordPress version (or plugin) update running setwpperms.cgi in a separate browser tab before returning to the dashboard will reset permissions of updated files to the correct ones.
David
Gabe
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: Wordpress - I give up

Quote from: btbonline
is this a conspiracy by Plusnet

Almost certainly. Some of that JFK footage clearly shows a Yorkshire terrier on the grassy knoll.
Quote from: btbonline
I see several such scripts in the forums across various threads but have no idea which one I should use - less still what they do!

Part of the confusion is caused by Wordpress itself, which sets permissions for uploads using a method which ignores suEXEC. suEXEC is used on the ccgi platform to stop the many users and their guest hackers running in and out of each other's houses borrowing cups of sugar.
The original script to set permissions selectively on the ccgi platform is here.
That sets folder permissions to 710, which is preferred for suEXEC, but the upload functions of Wordpress need 750 on the uploads folder and its subfolders, and this is what Wordpress recommends.
As per the original post, you can just edit that script: 'You can change "chmod 710" to "chmod 750", but don't edit "! -perm 1710", which tells the script not to chmod your root folder'.
That will work, but 750 is a bit slack to use generally, so you could just use the script as is and then set permissions on 'uploads' and subfolders to 750 using ftp, recursing for folders only. If that's too much bother then you could use David's modification, adding this line

find . -type d -regextype posix-extended -regex '.+/uploads($|/.*)' -print0 | xargs -0 chmod 750

straight after the line that reads

find . -type d ! -perm 1710 -print0 | xargs -0 chmod 710

or you could even just use the unedited script and plug Wordpress to stop it out-thinking itself, using something like:

<?php
/*
Plugin Name: Fix Upload Permissions for suEXEC
Plugin URI:
Description: Fix Upload Permissions for suEXEC
Version: 1.0b
Author: Gabe
Author URI:
*/
// Filter Hooks
add_filter('wp_handle_upload', 'upload_perms');
add_filter('wp_create_thumbnail', 'upload_perms');
add_filter('image_make_intermediate_size', 'upload_perms');
// Set Permissions
function upload_perms($file) {
$upload = (is_string($file) ? $file : $file['file']);
@ chmod( $upload, 0640 );
return $file;
}
?>

Save with no white space before
<?php

or after
?>

as fix_upload_permissions.php, upload as ascii to plugins, set permissions to 700 and activate.
I think that's about it, but I could be forgetting something.
Gabe
btbonline
Dabbler
Posts: 19
Registered: ‎25-11-2007

Re: Wordpress - I give up

Guys, I really appreciate your efforts - I have saved, uploaded, set perms and executed your suggested scripts as instructed but now I get another error - server 500???
I don't have the faintest idea what's going on here and by the looks of it I am going to have to go through this pain every time Wordpress release a new version and life's a tad too short. 
Thanks again but I think I've taken this as far as I can - having significantly exceeded the boundaries of my limited knowledge.  Time to pull the plug on the idea of a PN hosted site - more trouble than it is worth.  The secret of success is knowing when to stop.  Wink
Regards
Andy
Peter_Vaughan
Community Veteran
Posts: 14,469
Registered: ‎30-07-2007

Re: Wordpress - I give up

But don't stop while there are still suggestions... wordpress does work on the Plusnet hosting  Smiley
Most likely you have a .htaccess file in your wordpress directory with some incompatible settings. If you post the contents of it then we can probably sort it out.
btbonline
Dabbler
Posts: 19
Registered: ‎25-11-2007

Re: Wordpress - I give up

.htaccess - there was one once - there isn't one any more.  To be honest I think I may have deleted it in error out of sheer frustration and confusion.  So nothing to post for you to fix I'm afraid.  I relaise it won't work without one but I wasn't exactly getting much success with one either.  Please don't link me to any posts on here that 'explain' how the .htaccess file works cos I think I have read them all and they may as well be written in Mandarin for all the sense they make to me.  I believe you when you say that WP works on PN - just not in my case!
Gabe
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: Wordpress - I give up

Quote from: btbonline
.htaccess - there was one once - there isn't one any more.

Pesky thing's probably hiding - may have to set the ftp client to show hidden files.
Good luck elsewhere.
Gabe