[PHP] Cold Fusion conversion issues: app vars and cached queries

2002-12-03 Thread Steve W
My company is looking to move our site away from Cold Fusion due to
the cost. We had talked about JSP, but I would highly prefer PHP.
After evaluation, with the generic database functions now supporting
Oracle in CVS, I think this might be a possibility. However, there are
2 concerns I have in converting from Cold Fusion.

1) Application variables
2) Cached queries

I've seen some solutions to both problems, but mainly I want the
solution to meet one and ideally both of the following qualifications.
First, I don't want to have to use an add in module. I'd like to only
use core PHP functions and modules that are part of the full PHP
distribution and not SRM or other add-on modules. Second, I'd prefer
not to have to serialize the results, save as a file, and read the
file as updates would seem to become more difficult on higher load
systems with having to update files. Updates to our cached queries and
application variables generally only occur a few times a day.

These issues above as well as things like not being able to centrally
configure a database connection by using an alias for the name are
areas PHP lacks in comparision to Cold Fusion. Our CF application gets
installed at client sites. Using PHP, it would require a code change
in a db connect file to change the DB connection information where it
really should be configurable in a central PHP conf file.

Even with this being said, I'd like to use PHP for our application if
the 2 issues above can be resolved.

Thanks in advance,
Steve


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Cold Fusion conversion issues: app vars and cached queries

2002-12-03 Thread Chris Shiflett
--- Steve W [EMAIL PROTECTED] wrote:
 My company is looking to move our site away from Cold
 Fusion due to the cost. We had talked about JSP, but I
 would highly prefer PHP. After evaluation, with the
 generic database functions now supporting Oracle in CVS,
 I think this might be a possibility. However, there are
 2 concerns I have in converting from Cold Fusion.
 
 1) Application variables
 2) Cached queries

I can possibly field the first one.

ColdFusion has server, application, session, and client
scopes, right? Each have their own unique characteristics
about them. However, if you speak with the top Macromedia
engineers, you will see that client variables are preferred
in most cases for high-traffic applications.

Server, application, and session variables must be locked
with cflock to solve synchronization problems, and cflock
under load can present some noticeable bottlenecks.

CF's client variables are basically identical to PHP
session variables. Rather than having a variable scope such
as client.foo, PHP has an array $_SESSION[foo].

PHP, by default, stores session variables on the local
filesystem, so you will want to alter this behavior if you
are developing for a clustered environment (which I assume
you will be). You have much more flexibility in PHP to
alter its default session management mechanism than you
have flexibility in the cfapplication tag, but it is not
nearly as quick and convenient to do so (especially for
using a data store for session storage). However, once you
do this once, you will find that programming for the PHP
environment is no more difficult than for ColdFusion, and
you will probably learn to appreciate the flexibility.

I am not aware of an equivalent feature to ColdFusion's
cached queries, but perhaps someone else can speak up on
that one.

 I've seen some solutions to both problems, but mainly I
 want the solution to meet one and ideally both of the
 following qualifications. First, I don't want to have to
 use an add in module. I'd like to only use core PHP
 functions and modules that are part of the full PHP
 distribution and not SRM or other add-on modules.

If you use PHP's built-in session management, you will have
no problems with this. Your code will include any logic you
add to alter the default behavior, such as in the case of
using a central data store for session variables. If you
write your own utility, which is pretty trivial, you will
also not run into any trouble.

I honestly do not care for either PHP or ColdFusion's
built-in session management, so I prefer the flexibility
PHP gives me to alter its. When developing ColdFusion
applications for high-profile sites, I often implement my
own mechanism.

 These issues above as well as things like not being able
 to centrally configure a database connection by using an
 alias for the name are areas PHP lacks in comparision to
 Cold Fusion.

ColdFusion definitely makes managing database connections
easier. PHP has no equivalent to the cfadministrator, so
many things like this are easier with CF. However, I think
you will find that PHP has a slight edge in performance in
this regard, even when using native drivers (which you
should, of course) in CF. I cannot rightly comment on PHP's
Oracle support, however, as I have never used it.

 Our CF application gets installed at client sites. Using
 PHP, it would require a code change in a db connect file
 to change the DB connection information where it really
 should be configurable in a central PHP conf file.

There are differences, no doubt. I understand your point;
you let your clients configure their database connection
with cfadministrator and assign it a name that your code
uses in its cfquery tags. This makes code quite portable.

With PHP, it is not too much more trouble to ask them to
assign it a username, password, and name (of the database).
Otherwise, you can do like many people do and allow your
clients to configure and/or install your application
according to their own environment. Meaning, you don't
write cfadministrator in PHP, but you do let them change
database access credentials and any other basic
configuration by using your application.

 Even with this being said, I'd like to use PHP for our
 application if the 2 issues above can be resolved.

I wouldn't look to people being excited about trying to
match features with ColdFusion. PHP and CF are simply
different. In a survey done a year or two ago (around the
time CF 5 came out, I believe), PHP was rated as the most
flexible and efficient, and CF was rated as the easiest for
beginners and therefore generally more productive. Most PHP
developers would prefer to be free from all of the bloat
that would be necessary to make it as easy to administer as
CF.

Also, remember that a big difference stems from the fact
that CF is a separate process. PHP (when used as an Apache
module, for example) is nothing in and of itself. You
really just have a more intelligent Web server that can
parse PHP files.