cancel
Showing results for 
Search instead for 
Did you mean: 

ccgi down

Tony_W
Grafter
Posts: 745
Registered: ‎11-08-2007

Re: ccgi down

@spraxyt  - yes, I am tempted to agree about unchecked changes being made.
I used 'Agent Ransack' to search for all occurencies in my PHP files including all subdirectories, and then manually changed them.
For people to get a list of global server variables, they can use this (found on the internet):
<?PHP
    foreach($_SERVER as $key_name => $key_value) {
    print $key_name . " = " . $key_value . "<br>";
}
?>

It shows the variables available and their current values. People can then use their own search and replace methods if they want.
Tony
Astronut
Dabbler
Posts: 23
Thanks: 3
Fixes: 1
Registered: ‎31-01-2010

Re: ccgi down

'Tis I again with another .htaccess query:
Can anyone tell me the rewrite rule to get rid of the ~username part of the ccgi url?
At present, I can get to my site with http://www.domain.co.uk/, but any further links are coming up as http://www.domain.co.uk/~username/.  This is also appearing in the automatically-generated "base" statement on my pages.
Thanks,
Jon
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ccgi down

I think reply #16 in this thread probably provides the most comprehensive answer to your question.
The cgi-platform-php-upgrade-faq in the Customer Library cross-refers to that.
David
David
Tony_W
Grafter
Posts: 745
Registered: ‎11-08-2007

Re: ccgi down

@spraxyt
Going back to the register_globals problem, perhaps just doing the search and notifying the filenames still containing any global variables would help.
The user could then whittle down the list until it ran 'clean'.
I understand that this means work for someone writing the script, but it means a 'belt and braces' approach could be used before switch-off.
Tony
Astronut
Dabbler
Posts: 23
Thanks: 3
Fixes: 1
Registered: ‎31-01-2010

Re: ccgi down

Hi David,
The problem was that I don't really understand what Gabe is talking about - .htaccess is completely dark to me!
As it happens, it looks like the problem had nothing to do with .htaccess, merely the way my CMS was getting the values from PHP's settings.  I've made two sets of alterations to my code and it seems to be working fine now.  (Now, PHP I understand...)
Thanks anyway!
Jon
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ccgi down

Quote from: Astronut
As it happens, it looks like the problem had nothing to do with .htaccess, merely the way my CMS was getting the values from PHP's settings.  I've made two sets of alterations to my code and it seems to be working fine now.  (Now, PHP I understand...)

Thanks for the feedback, glad to hear you got it working.
Are you happy to mention the CMS and what you changed? Could help others.
David
David
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ccgi down

Quote from: Tony
Going back to the register_globals problem, perhaps just doing the search and notifying the filenames still containing any global variables would help.
The user could then whittle down the list until it ran 'clean'.

@Tony
Yes, drawing attention to global variables used in $global_var_name style is a good suggestion. I'll discuss this with Plusnet.
David
David
tonycollinet
Grafter
Posts: 1,140
Thanks: 5
Registered: ‎14-08-2007

Re: ccgi down

Ouch - Just come here, and noticed for the first time. My two sites are accessed relatively infrequently by me, but are important for others.
I have two sites, neither of which is working. One is based on Joomla, and the other on Drupal. The Joomla one is giving a joomla holding page, stating "The site is temporarily unavailable, please contact the administrator". The Drupal one is giving the message
"Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500"
Can anyone give me a potted history of what has happened. For example - have all files been restored from a backup? What about the database? PHP.ini? etc.
and what I am likely to need to do to fix it. So far, all I have tried is to change permissions of all files to 755.

Thanks for any help.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ccgi down

The Customer Library Update FAQ is probably the best potted history there is.
User files were moved to the new server unchanged, and databases weren't affected.
The FAQ explains some of the causes of Error 500 (perhaps a .htaccess option in your case?). Does that provide the help you need?
David
David
Tony_W
Grafter
Posts: 745
Registered: ‎11-08-2007

Re: ccgi down

Quote from: spraxyt
Yes, drawing attention to global variables used in $global_var_name style is a good suggestion. I'll discuss this with Plusnet.

There might be something that can be used as a starting point here
It is a global search and replace script, but it might be amendable so that it just uses the search section and outputs the filename. The search string and replace string are included as variables. Obviously it could be modified to search for all of the register variables in each file and then output the filename plus the list (perhaps).
Anyway, not knowing perl, I don't know how easy the amendment would be, but the code seems very terse, very like the UNIX commands e.g. grep.
Tony
Gabe
Grafter
Posts: 767
Registered: ‎29-10-2008

Re: ccgi down

Quote from: Crookwood
it's throwing out ~username on each URL, which might confuse my google cache...

Which version of Joomla is this? I have a test install of 1.5.14, which I don't use or understand but the example pages seem to work with all three SEF options on and its not generating /~username in the url. Or am I missing something?
Gabe
Gabe
Grafter
Posts: 767
Registered: ‎29-10-2008

Re: ccgi down

More than one way to skin a cat: this is one way. It's not necessarily the best, just an option.
Aims:
To avoid the problem with ~username ending up in PHP variables and causing problems with POSTs, etc. - and avoid the ~username appearing in the url after you POST.
To avoid the need for more than one custom php.ini file to cover all folders.
(A side effect is that sites will run without resetting permissions on php files, though they should still be reset for security.)
Method:
This is a Marmite method (some won't like it at all and it may not work perfectly for every situataion). It uses a wrapper script to reset certain PHP variables. The php.ini for the wrapper then covers all PHP files in all folders.
First create a wrapper script:

<?php
$_ENV["SCRIPT_NAME"]=$PHP_SELF=$_SERVER['PHP_SELF']=$_SERVER["SCRIPT_NAME"]=$_SERVER["REQUEST_URI"];
$_ENV["SCRIPT_FILENAME"]=$_SERVER["SCRIPT_FILENAME"]='/files/homeX/username'.$_SERVER["REQUEST_URI"];
ereg('^/~username(.*)/([^/]*\.php)$', $_ENV["REDIRECT_URL"], $wrap_url);
chdir('/share/storage/0X/us/username'.$wrap_url{1});
include $wrap_url{2};
?>

Edit the above, replacing "/files/homeX/username" in line 2, "username" in line 3 and "/share/storage/0X/us/username" in line 4. "username" is your username and the other strings may be found by placing a <a href="http://community.plus.net/forum/index.php/topic,83568.msg696223.html#msg696223">php.ini file</a> along side a phpinfo() file in your root folder.

<?php
phpinfo();
?>

Chmod the phpinfo file 0700 and call it in a browser. The first string appears under PHP Variables, against _SERVER["SCRIPT_FILENAME"] (just the bit up to username). The second will appear at the top, against "Loaded Configuration File" (again, just the bit up to username).
Name the file "phpwrapper.php", place it in your root folder alongside the php.ini file and chmod it 0700.
Then create a .htaccess file

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{REQUEST_URI} \.php$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !^/~username/phpwrapper\.php
RewriteRule .* phpwrapper.php

replace "username" and place the file in your root folder.
Call the phpinfo file again and notice that the relevant PHP variables have changed. Place the phpinfo file in another folder, call it and notice that register_globals is still off.
The rewrite rules in .htaccess can be combined with others. For instance, to run a Wordpress blog from a subfolder, while giving the appearance that it's in the root, you could use something like:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$ $1/ [R,L]
RewriteCond %{HTTP_HOST} ^ccgi\.yourdomain\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/~username/wordpress/
RewriteRule (.*) /wordpress/$1
RewriteCond %{REQUEST_URI} \.php$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} !^/~username/phpwrapper\.php
RewriteRule .* phpwrapper.php

and change the Wordpress address to http://ccgi.yourdomain.co.uk in Settings.
If your site uses .htaccess files in subfolders then the wrapper rewrites will also need to be added to those files, with the wrapper referenced as ../phpwrapper.php (adding more ../ for each folder level down).
Ok, I hope that hasn't just confused things. It's only an option.
Gabe
tonycollinet
Grafter
Posts: 1,140
Thanks: 5
Registered: ‎14-08-2007

Re: ccgi down

Ok - lets do this one at a time, starting with the joomla site, which is the most important.

I am running an oldish version due to template compatibility - 1.0.11. I can access the admin backend seemingly without problem. However, trying to access the main site, I get the site error message outlined above. Permissions are set globally to 755. I've tried 700/710 as in the FAQ, and then the backend breaks as well.
As far as I can tell, there is no .htaccess file. I have a PHP.ini file.
EDIT - renaming the php.ini to php.ini.old seems to have fixed the problem.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: ccgi down

Quote from: Tony
Quote from: spraxyt
Yes, drawing attention to global variables used in $global_var_name style is a good suggestion. I'll discuss this with Plusnet.

There might be something that can be used as a starting point here

@Tony
Thanks for that link. The Perl program action is to find all files with a '.html' extension (easily changed), read each of them in turn into memory, globally replace a specified 'from' string with a 'to' string and write each file out again. The writer mentioned needing to change some 30000 pages, which could take a long time - running the script unattended in the background was suggested, not an option for us.
For our requirements a shell script employing 'grep' run on the server might be faster, though there are potentially a lot of global variables to search for and run time could be an issue (for impatient users).
David
David
scottp
Newbie
Posts: 2
Registered: ‎22-03-2010

Re: ccgi down

Quote from: Bob
The platform should now be back up and the announcements are on their way...

Bob - According to the forum ccgi should now be up and running.  I host a website (www.1ststpetersseascouts.co.uk) using Joomla 1.5.8 via the PlusNet ccgi service which is no longer working since the upgrade.  I have carried out some testing including removing my .htaccess and find I can run a 'test.php' in the root folder but can not run it from a subfolder.  Can you explain why this is please.
I am very frustrated as the site has been running for about 18 months with no issues and suddenly it will not work since the upgrade.  Please can you help?
(Note:  I have put a temporary HTML based message on the site to inform of the problem so if you try and access the site this is NOT the Joomla site).