Welcome Guest, Not a member yet? Register   Sign In
Good ORM for PHP4
#1

[eluser]Tim Stackhouse[/eluser]
I'm building my first project with CI and because of our hosting environment I'm being forced into PHP4. I've got a handful of modules defined, however I still have several more that I need to create, and I'm just seeing any kind of relational mapping between my modules becoming an absolute nightmare without ORM. From what I've found, DataMapper looks to be a popular solution, however it is PHP5 only, and thus not suitable for this application.

I've found Ignited Record, and it seems to have good PHP4 support, however I wanted to get opinions of integrating something like this into an existing project, where the database is already completed and ready to accept data, I'm just building the frontend (I can restructure the DB, however I'd like to avoid it if possible).

I'd love to hear people's opinions on this and I can provide more details/examples from my current codebase/db schema if it helps make my situation clearer. Thanks in advance & I look forward to learning more about working with CI.
#2

[eluser]TheFuzzy0ne[/eluser]
Just out of interest, why are you being forced into using PHP 4? Can you not explain the situation in simple terms, and say that [url="http://www.onphp5.com/article/16"]PHP 5 is more secure[/url]?
#3

[eluser]Tim Stackhouse[/eluser]
Ideally we would be running PHP5, however the crux of the matter is the following: Our dedicated server, which is the final destination for this project, is managed using Plesk which requires PHP4, so we're stuck using it for the time being, unless we decide migrate to another control panel (or a newer version of Plesk that supports PHP5).
#4

[eluser]TheFuzzy0ne[/eluser]
As this is your own dedicated server, can you not specify which PHP version to use for different apps?
#5

[eluser]Tim Stackhouse[/eluser]
I don't believe so, I think it has to do with the way Plesk integrates with the way the system works. I'm not entirely sure, but we're currently leading the campaign (myself and a co-worker who's the de facto admin) to move forward with getting rid of Plesk so we can have PHP5, along with being rid of other things that Plesk does just plain weird. But, until we do, we've got to tough it out with PHP4, which is part of why we've built a bunch of sites on EE, it's powerful & supports PHP4.
#6

[eluser]TheFuzzy0ne[/eluser]
The default PHP running is governed by what's in /etc/alternatives. If that's set to PHP 4, then that's the default, and Plesk should use it. If you also have PHP 5 installed on your server too (yes, the two will quite happily co-exist together), you can add something like this to your htaccess file:

Code:
# To switch to PHP 5.0:
AddHandler application/x-httpd-php5 .php .php5 .php4 .php3

# To switch to PHP 5.1:
AddHandler application/x-httpd-php51 .php .php5 .php4 .php3

# To switch to PHP 5.2:
AddHandler application/x-httpd-php52 .php .php5 .php4 .php3

Ta-da! You can now use PHP5 with your Web app, and Plesk is none the wiser. I truly believe this is the solution to your problem (which is why I won't take the hint Tongue).
#7

[eluser]Tim Stackhouse[/eluser]
I did not know this! I'll have to do some more research and see what's out there. As if this thread hasn't been derailed enough, think you could point me in the right direction for more info about that re:RHEL?
#8

[eluser]TheFuzzy0ne[/eluser]
Hmm. I have never had to install anything on RHEL, so I'm not sure quite where to start. I use Debian, which uses apt-get to install packages from the repository, but I think RHEL uses yum(?)

I can show you the steps that I would take to get it working on my set up. Hopefully it might get you going in the right direction. Another alternative might be to ask your Web host. This is a relatively straight forward job, and if they are feeling particularly gracious, they might set it up for you for nothing.

OK, on my Debian system, I'd need to su to root (of course).

Code:
hope:/# su

Then I'd install the PHP 5 modules for apache2. Your package name may vary from mine, but:
Code:
hope:/# apt-get install libapache2-mod-php5

The setup will ask me to confirm that I want to install it, and might ask one or two simple questions (but I don't think it does), and then it downloads it and installs it for me.

I don't know if it will override the current default PHP version, so check it first:

Code:
hope:/# ls -la /etc/alternatives/php
in my case, the output is: lrwxrwxrwx 1 root root 13 2009-04-24 22:08 /etc/alternatives/php -> /usr/bin/php5 - so PHP 5 is the default. To change it to PHP 4, I'd do this:

Code:
hope:/# rm /etc/alternatives/php && ln -s /usr/bin/php5 /etc/alternatives/php

The above removes the old /etc/alternatives/php symlink, and replaces it with a new one pointing to PHP 4

Now. I'm having second thoughts as to whether or not this sets the default for apache to use. However, everything is totally reversible, and worse case scenario, you might have to just add an htaccess file to the Plesk Web root, or a line to the existing one telling it to use PHP 4 (if there's not on in the already).

I would certainly suggest you try it and see what happens. As I said, it's totally reversible, and I'm happy to help you troubleshoot if the need arises, but I'd still recommend you explain the situation to your Web host, and see what they suggest, as they will have much more experience with RHEL, and probably know how to do this in their sleep.




Theme © iAndrew 2016 - Forum software by © MyBB