views:

239

answers:

6

Does using a PHP framework (CodeIgniter, Zend) require special server side setup? And if yes, is there a PHP framework which doesn't require that?

The intention would be to use a hosting server which supports plain PHP only (no framework installed - if that makes sense), and use the mentioned framework on the development machine only, which would then be preprocessed ("compiled") into plain PHP.

[Edit]

To all you guys: sorry for the newbie question, I guess I got it wrong. I have only worked in .NET so far, and I haven't done anything from scratch in PHP yet. For this small project I am supposed to do, I wanted to learn and use CodeIgniter, as it seems like a light MVC framework where I can get results quickly.

Before starting, I wanted to check with the hosting provider (from which my customer has already bought a year of hosting) said they only support Zend. So, I guess that's nonsense then?

[Edit 2]

To make my question complete, here is what their hosting package provides:

  • PHP 5 or PHP 4
  • Perl
  • CGI
  • Python
  • Tomcat / JSP Tomcat 5.5.9 / Servlet 2.4 / JSP 2.0
  • FrontPage extensions
  • Ruby On Rails
  • PHP / Zend optimizer
  • PHP / IonCube
  • Fantastico
  • DB: MySQL Server 5, PostgreSQL Server 8

To be precise, my question was (since I am a newbie after all):

Q: Which PHP frameworks do you support (Zend, CodeIgniter...)?
A: We support Zend, but not CodeIgniter

Now I am aware that the question itself is a bit dumb, so I might contact them again.

+1  A: 

See EZMVC, it does not require server-side settings/handling.

Sarfraz
Yes but EZMVC says it is like CodeIgniter, CakePHP, or symfony without the features, i assume they mean helpers and ORM etc. But Codeigniter does not require any server side setup. All of the frameworks will need "configuration" but only in the way that any plain PHP app would require configuration surely?
PurplePilot
+6  A: 

No php framework I know of needs any special server side setup. PHP frameworks are just that: plain PHP only, as you call it. PHP frameworks are nothing more than already written PHP code for you to build your further code on. Nothing special about it.

People sometimes ask question on 'how to install' this or that framework which derives from the same missconception that frameworks are some kind of bundled software that need complicated distributed installation routines. None of that. Just code you didnt' write yourself. And as that you just need to upload (or download) to server. Done.

[EDIT] after your edit: I slightly doubt the competence of your hosting company. You might have a missunderstanding with them as 'Zend' often means Zend Optimizer or Zend Guard or such. As to PHP frameworks your host doesn't need to support or not support them. It is entirely up to you what PHP code you upload to that host and who has written that code.

Some hosting companies offer framework support in a way that the frameworks are already available on their servers and are updated by your host. And surely there are a few things that can be optimized like php.ini settings. But in general it will work also without these optimized settings.

I almost never accept hostings that a client has already purchased. When I write an offer I attach the strings that the hosting is chosen by me. If I'm satisfied with what the client already has, the better for him.

tharkun
+1. Thanks, now that you've said it, I found this: http://www.codeignitor.com/user_guide/installation/index.html. No special setup needed. I guess I found some odd pages while googling yesterday. So, "not supporting CodeIgniter" on a PHP 5 server is nonsense?
Groo
Well, that might be true because CodeIgnitor is based on PHP4. And that's exactly why I strongly recommend NOT to use CI! Kohana or Zend Framework would be a much better option! The guys at CI know that this is not to their advantage so the info is really hard to find on their page.
tharkun
On the other hand, most 'normal' PHP hostings will run CI code without problem.
tharkun
@tharkun, Zend Framework relies on it being added to the include_path. If you can't do that in PHP by host restrictions or the like, your host needs to support it.
The Guy Of Doom
@doom: not true, if your host doesn't want to do that for you, you can add the framework to the include path at runtime (in your bootstrap)!
tharkun
@tharkun: I agree completely. However, if I were to propose a hosting package, I would have probably gone for a windows (.NET) maching, since I have good knowledge of ASP.NET. But since it's a spare time project, I thought I might as well learn something new, so now I can basically go in any direction (I could easily go for Zend if everything else fails).
Groo
+1  A: 

AFAIK the only thing that is not server-independent is the rewriting of links, as Apache, nginx, IIS and others, all have different rewriting engines/syntax.

robertbasic
A: 

I have worked on many php frameworks such as Zend framework, Cakephp, codeigniter and YII. Of these I liked YII ( http://www.yiiframework.com ) the most because it is easy to learn, purely Object oriented and works almost like the Ruby on rails framework. It also has great documentation and is very fast. Yii unlike codeigniter works on PHP 5 only which gives it capabilities like auto loading of classes.

But the only problem with frameworks are that they require configuration settings. You cant make it work without one config file atleast.

thinktejas
`@thinktejas`: now you may start confusing the OP again. The configuration you're talking about is not connected to the server. It is configuration of the app itself and every non-trivial PHP app needs it in some form. it's just a place where you store your database connection details, admin-emails and such.
tharkun
Hmmm in that case YII requires PDO and its related DB drivers for DB access.
thinktejas
@tharkun: thanks, I am aware that I will need to setup some configuration settings with any fw. I only want to make sure that I can upload all working files without being dependent on their server configuration.
Groo
+3  A: 

The only setting you need to configure for CodeIgniter is $config['base_url'] which is used for building links and form actions. Then you should be good to go, as CodeIgniter (and all other frameworks) are just PHP and nothing more.

That said, there are of course environment issues to watch out for. If you are moving from your localhost to a server with a totally different install then there will of course be things that need to be changed, such as $config['uri_protocol'] as sometimes you will get 404's, blank pages or default controller loading when you look at other pages. This can normally be fixed by flicking through each of the uri_protocol options listed just above the option. This is not very common, just something to keep in mind.

And finally of course, don't forget to chmod your writeable upload folders and keep your DB settings correct.

Take a look at my article on "how to get CodeIgniter working on different production environments" without too much faffing with db config.

Phil Sturgeon
+1. Thanks. One more question, does the same hold true for Kohana (zero config)? I am experienced in C#, and from what I've seen, it should provide a better OOP "feel" (PHP 5 vs PHP 4 in CodeIgniter).
Groo
I would assume so, PHP framework really do not need much tinkering to get going.
Phil Sturgeon
A: 

Did you try cakephp? I am using yiiframework and I needed to do a project with php 4, so I used cakephp that I liked it too.

dimis