New to DreamHost, need to use PHP(+CodeIgniter) and SQLite

software development

#1

So I assumed that DreamHost used apache mod_php for PHP (as is the standard for most hosts), since they didn’t say anything about PHP being run as CGI on the features page, you can understand my surprise when I read in the wiki after registering that PHP is run as CGI.

What would I have to do to get my scripts that were developed using PHP (and based on CodeIgniter) that also use sqlite(3) working correctly on DreamHost?

I’m used to php as mod_php, I have no clue on how different it is from this implementation.
My last host also had sqlite pre-installed, I have no clue of where to start with installing and configuring it to how I had it.

I’ve tried reading the wiki but it provides no information on what I’m after, it simply states that PHP is ran as CGI and gives no information on how it’s different from what users may be used to. I have no clue of what the SQLite wiki is talking about.

So can someone give me some instructions on how to get it all set up? I’m hoping that hosting my work will require little to no modifications to the scripts themselves to get them to work on dreamhost servers as they’re mostly fairly old and it’ll be a nightmare if there’s much I have to change in my code to get it all to work.

Also when I searched the forums to see if this or something similar has already been explained, I came across a post with someone saying that the $GLOBALS variable in php has been or will be disabled on dreamhost - is this true? One of my most recent scripts uses it in a lot of places (at the start of the script it reads the app’s configuration from a file then sets them to a key in $GLOBALS so that they don’t get overwritten or anything by my careless variable naming)

Thanks in advance :slight_smile:

[edit] So by uploading all my stuff (took ~2 hours and still not all sorted out but ohwell) I’ve found that most of my stuff is working fine, except for: http://scripts.powerindesign.com/heat/ . For some reason CI returns 404 not found, no matter what. I think it might have something to do with my .htaccess because it’s only for the codeigniter app that stuff is being quirky(so far), it was fine before i set up the scripts.powerindesign.com subdomain and I’ve read a lot of people having .htaccess/mod_rewrite problems on the forums.
My .htaccess file in http://scripts.powerindesign.com/heat/ :

RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]

#2

From what I remember when I looked into this, there are no real differences from the PHP code point of view. If it runs on mod_php, it will run as CGI. It has to do with which shares memory space with apache and such. The CGI version runs in its own memory space so that if it crashes, it doesn’t bring down the server as well. I’m not an expert, but I think there are very few things you need to worry about. You can also create your own php.ini file and even install your own CGI version of PHP, so there shouldn’t be any problems. I’ve moved a Dwoo based application from our development server using mod_php to Dreamhost with no issues.

Can’t help on SQLlite, but PHP abstracts that actual database using PDOs, so my understanding is that if you use PDO, you’re good to go for almost any situation.

As for your htaccess, are you sure the $1 is supposed to be in the RewriteCond declaration? I’ve never seen it used there. Try taking it out.


#3

Yeah it’s copy-pasted from http://codeigniter.com/user_guide/general/urls.html, my CodeIgniter script has worked everywhere else but on this DreamHost server, It might not be the .htaccess, I guess I’ll just have to debug it and figure it out myself.

Also I just got an error (500 i think) when I tried removing that $1


#4

make sure that your config file points to the absolute path of your base file /home/user/domain.com/index.php

usually frameworks reference all other files based on the absolute location of one.


#5

Hi.
SQLite is integrated into PHP 5.x. Version 5.2 contains SQLite 3.3.7 and version 5.3.4 contains the 5.7.3 which supports foreing keys and FTS. Just set your domain in panel to use PHP5.2 FastCGI or 5.3 FastCGI and you are good to go.
The FastCGI thing improves speed because the PHP executable should not be reloaded each time an user requests a page.


#6

That being said, please keep in mind that SQLite has some limitations on concurrent usage that make it unsuitable for use on a busy site. Please use MySQL for any serious database activity!


#7

Hi Andrewf
I friend is planning to use SQLite on a web project.
Do you know where do I can find more information about those limitations?
Thanks


#8

The SQLite web site has a good page on “Appropriate Uses For SQLite”:

http://sqlite.org/whentouse.html