Shared Hosting

From EggeWiki
Revision as of 07:27, 17 October 2007 by Egge (talk | contribs) (New page: I use Linksky to host this website, and they provide a reasonable Linux shared hosting solution. The problem with any shared hosting, and especially with PHP, is that you never know when ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

I use Linksky to host this website, and they provide a reasonable Linux shared hosting solution. The problem with any shared hosting, and especially with PHP, is that you never know when your environment is going to change.

MediaWiki

In my latest what is going to break today?, LinkSky deleted my .htaccess file out of my MediaWiki directory. I went to edit my OS X Tips tips, and i received this 406 error:

Not Acceptable
An appropriate representation of the requested resource /wikimedia/index.php could not be found on this server.

How do I know it was deleted? Well, I had this problem before when the SecFilterEngine was first added. I fixed it by changing my .htaccess file. Fortunately, I have aged complete backups of my site. I just had to go to last weeks backup to recover the file. Here's my .htaccess file:

<geshi lang="bash"> php_flag register_globals off SecFilterEngine Off </geshi>

I don't have to disable this everywhere, but in my wiki, I do tend to put lots of nasty commands like /bin/rm.

Gallery2

The way I always find out is when something that was working suddenly stops. The case today, is my image block on this site's home page. Originally, the block was created with this code:

<geshi lang="php"> @readfile('http://www.theeggeadventure.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=recentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage&g2_show=none&g2_maxSize=50'); </geshi>

When it stopped working, I changed it to this:

<geshi lang="php">error_reporting(E_ALL); readfile('http://www.theeggeadventure.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=recentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage&g2_show=none&g2_maxSize=50'); </geshi>

That did not produce any error messages, so I tried this suggestion:

<geshi lang="php">

 $ch = curl_init();
 $timeout = 5; // set to zero for no timeout
 curl_setopt ($ch, CURLOPT_URL, 'http://www.theeggeadventure.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=recentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage%7CrecentImage&g2_show=none&g2_maxSize=50');
 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
 $file_contents = curl_exec($ch);
 curl_close($ch);
 echo $file_contents;

</geshi>

Today, this is working, but at some point the web host may disable curl, and then I'll have to find another solution. If I had a more important site, I'd pay for virtual hosting or dedicated hosting. If I had more time and bandwidth, I'd run the server at my home.