Scuttle/Redirector

From DreamHost

Jump to: navigation, search
This article or section may require a cleanup.
We are hoping to create articles that meet certain standards. Please discuss this issue on the talk page. Editing help is available.


Contents

Problem

My Scuttle installation on Dreamhost generates a lot of "No input file specified." errors, depending on the page I'm trying to display.

Solution

I've come up with a solution that does not require hacking of core files, so whenever an update of Scuttle is available, you don't have to hack over and over again. All you need is adding a file (the redirector) and adding a line in your .htaccess

What we'll be doing is redirect all pages requests through our own redirector script, which should hopefully display pages instead of errors.


.htaccess editing

Make your .htaccess file like the following (assuming your Scuttle install sits in directory /bookmarks/, so change syntax accordingly)

Options  FollowSymlinks
# AcceptPathInfo On
RewriteEngine On
RewriteBase /bookmarks/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([^/] )/?(. )?      /bookmarks/$1.php/$2       [L]
RewriteRule . /bookmarks/ozh.php [L]

Differences from the original .htaccess file are:

  • comment out line number 2
  • comment out the last RewriteRule
  • add an extra RewriteRule (the one with ozh.php)

The extra file

Create the following file ozh.php in your Scuttle directory :

<?php
/*
Script Name: Scuttle Redirector Fix
Script URI: http://wiki.dreamhost.com/index.php/Scuttle
Description: (Should) fix all 'No input file specified.' errors with Scuttle on Dreamhost. Check the above URL for description.
Version: 0.1
Author: Ozh
Author URI: http://planetozh.com/
*/

/* what dir are we in ? */
$basedir = basename(dirname(__FILE__));

/* what is requested ? */
$uri = rtrim(str_replace("/$basedir/",'',$_SERVER['REQUEST_URI']),'/');
list($page,$param) = explode('/',$uri);
list($param,$query) = explode('?',$param);

/* from now on, with the following urls, we have the following vars :
        /about/                 ->      $page='about'
        /tags/code              ->      $page='tags',$param='code'
        /tags/code?page=2       ->      $page='tags',$param='code',$query='page=2' */

/* Replace global vars with our made up values to feed Scuttle with them */
$_SERVER['PATH_INFO']=$page.'/'.$param;
$_GET['page'] = trim($query,'page=');

/* Now that we modified global vars, let's go ! */
include($page.'.php');


?>


Scuttle Config

This trick works with "clean urls" activated, so be sure to properly edit config.inc.php :

$cleanurls          = true;


Your mileage

27 April 2007 Would I need to make any changes to ozh.php if I want to install scuttle into the root? Here is my scuttle install http://www.golfmarks.org/, click around and you will see the errors

... may vary, as usual. This works fine (as of march 2007) on my own scuttle installation, running Scuttle 0.7.2 (unmodified except for the stuffs detailed above) with Dreamhost's PHP 5.2.1 (see phpinfo() for more details)


20 March 2007 - Lloyd (http://betheglue.org/splotz) I had the same warning as Antoha. This occurred while trying to install into the root. When I moved it to a subdirectory it all went smoothly. I have it working now (see link above). Not sure why that made a difference.


19/03/07 Antoha Don't work at me

Warning: include(.php) [function.include]: failed to open stream: No such file or directory in /home/***/***/mysite.com/ozh.php on line 29

Warning: include() [function.include]: Failed opening '.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/***/***/mysite.com/ozh.php on line 29

Help :)))

Personal tools