php-general Digest 28 Dec 2008 11:54:49 -0000 Issue 5869

Topics (messages 285110 through 285134):

Webhotel structure
        285110 by: Nordstjernealle 10
        285112 by: Daniel Brown
        285116 by: Richard Heyes
        285117 by: John Corry
        285118 by: Dotan Cohen
        285122 by: Carlos Medina
        285131 by: Robert Cummings

Re: PHP script gives no output or error message
        285111 by: John Musbach
        285113 by: John Musbach

Re: PHP (under httpd) reading a file outside DocumentRoot?
        285114 by: Jeff Weinberger

how to update PHP 5.2.6 to 5.2.8 under Fedora Redhat Linux 9
        285115 by: Fred Silsbee

Is PHP truly faster on the JVM?
        285119 by: John Papas
        285124 by: Nathan Nobbe

Re: Decorator with public methods
        285120 by: Nathan Nobbe
        285121 by: Nathan Nobbe

Architecture patterns in PHP
        285123 by: Michael C. Yates
        285125 by: Daniel Brown
        285126 by: Ashley Sheridan
        285127 by: Michael C. Yates
        285128 by: Nathan Nobbe
        285130 by: Murray
        285132 by: Larry Garfield
        285133 by: Phpster

errors still being displayed even if variables in php.ini set to off
        285129 by: Fred Silsbee
        285134 by: Ashley Sheridan

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi PHP experts

What is the overall structure on webhotels, how do I remove/clean everythink 
including everythinnk liek databases etc?

Sorry if this is not the proper news group for this question, please redirect 
me.
I am a newbie trying to make my osn webside with a minimum effort.

First I had a student to make some think for me, but he never finished it, so 
the useless remains are on my web.

My first plan was to use php gallery, but my web host surftown do not support 
safemode off.
So I found coppermine, surftown even support the install as one click.
First trial looked good, but then I ran into trouble, I get different error 
messages.

So I would prefer to remove everythink and start all over .



best regards

Peter Sørensen



--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 15:27, Nordstjernealle 10
<nordstjerneall...@gmail.com> wrote:
> Hi PHP experts
>
> What is the overall structure on webhotels, how do I remove/clean everythink 
> including everythinnk liek databases etc?
>
> Sorry if this is not the proper news group for this question, please redirect 
> me.
> I am a newbie trying to make my osn webside with a minimum effort.
>
> First I had a student to make some think for me, but he never finished it, so 
> the useless remains are on my web.
>
> My first plan was to use php gallery, but my web host surftown do not support 
> safemode off.
> So I found coppermine, surftown even support the install as one click.
> First trial looked good, but then I ran into trouble, I get different error 
> messages.
>
> So I would prefer to remove everythink and start all over .

    What?

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--- End Message ---
--- Begin Message ---
>    What?

Seconded. Are you talking about hosting?

-- 
Richard Heyes

HTML5 Graphing for FF, Chrome, Opera and Safari:
http://www.rgraph.org (Updated December 20th)

--- End Message ---
--- Begin Message ---
+1

Is it me or has the php mailing list kind of dumbed itself down in the
last 5 years?



>
>    What?
>
> --
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Unadvertised dedicated server deals, too low to print - email me to find out!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
2008/12/27 Daniel Brown <danbr...@php.net>:
>    What?
>

What's not clear? He asked about webhotels, he obviously intends on
having extramarital cybersex.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü

--- End Message ---
--- Begin Message ---
Nordstjernealle 10 schrieb:
Hi PHP experts

What is the overall structure on webhotels, how do I remove/clean everythink 
including everythinnk liek databases etc?

Sorry if this is not the proper news group for this question, please redirect 
me.
I am a newbie trying to make my osn webside with a minimum effort.

First I had a student to make some think for me, but he never finished it, so 
the useless remains are on my web.

My first plan was to use php gallery, but my web host surftown do not support 
safemode off.
So I found coppermine, surftown even support the install as one click.
First trial looked good, but then I ran into trouble, I get different error 
messages.

So I would prefer to remove everythink and start all over .



best regards

Peter Sørensen



Hallo Peter,
i think i understand what you mean (again: i think) but i am not really sure to understand what you need.
You need some Support on PHP? and when yes, by what?
When you dont need support for PHP please tell us, what you are looking for? Do you need Suport for coppermine? then look here http://documentation.coppermine-gallery.net/en/languages.htm You want remove all the Application on your server and you dont know how? What is your System, where ist Your Server System? Do you need some Support from PHP programmer? Please contact me then :-) (reply only to me then)


Regards

Carlos Medina



--- End Message ---
--- Begin Message ---
On Sat, 2008-12-27 at 15:54 -0500, John Corry wrote:
> +1
> 
> Is it me or has the php mailing list kind of dumbed itself down in the
> last 5 years?

Hey, that's almost as long as I've been here...

*blink* ... *blink* *blink*

:O

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 1:13 PM, Daniel Brown <danbr...@php.net> wrote:
>    Good afternoon, John;
>
>    There's a syntax error on line 19:
>
>> if(external_fud_login(fud_fetch_user($user)['id']))!=NULL) //User ID is 
>> valid and logged in
>
>    It should be:
>        if(external_fud_login(fud_fetch_user($user['id']))!=NULL)
> //User ID is valid and logged in

Thanks, turns out there were multiple problems with my code. My final
working code is:

<?php
//Here we grab the authenticated user's name
//and either automatically log them in using an existing account
//or register them

require_once('/users/u15/jmusbach/.html_pages/FUDforum2/GLOBALS.php');
require_once('/users/u15/jmusbach/FUDforumDAT/scripts/fudapi.inc.php');
require_once('/users/u15/jmusbach/FUDforumDAT/scripts/forum_login.php');

global $_SERVER;
$user=$_SERVER['WEBAUTH_USER'];
$realname = $_SERVER['WEBAUTH_LDAP_GIVENNAME'] . ' '
.$_SERVER['WEBAUTH_LDAP_SN'];
$email = $user . '@blah.com';
$uid=_fud_simple_fetch_query(array("'".$user."'"), "SELECT * FROM
".$GLOBALS['DBHOST_TBL_PREFIX']."users WHERE login IN({ARG})");
$login=external_fud_login($uid->id);
if(!empty($uid->id) && !empty($login)) //User ID is valid and logged in
{
        //echo("Welcome, " . $user . ", please wait while you are
logged in...");
        header( 'Location: https://blah.com/~jmusbach/FUDforum2/?S='.$login);

}
else //User ID is invalid, register and log in
{
        //echo("Welcome, " . $user . ", please wait while you are registered
and logged in...");
        $vals['login']=$user;
        $vals['passwd']="password";
        $vals['email']=$email;
        $vals['name']=$realname;
        $uid=fud_add_user($vals,$error);
        $login=external_fud_login($uid);

        if($uid!=0 and empty($error))
        {
          header('Location: https://blah.com/~jmusbach/FUDforum2/?S='.$login);
        }
        else
        {
          echo($error);
          die();
        }
        
}



?>

for anyone who may be trying to accomplish the same thing as me. In
addition I edited index.php in the themes folder and added a php
clause such that in the event the user is anonymous they are
redirected to the autologin.php script and I also edited the
register.php themes script to omit the UserCP password field and
password confirmation since everyone in this setup is assigned one
long random password (the thought being that the kerberos
username/password is enough to worry about, there should be no need to
worry about another username/password).

-- 
Best Regards,

John Musbach

--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 3:32 PM, John Musbach <johnmusba...@gmail.com> wrote:
>
> Thanks, turns out there were multiple problems with my code. My final
> working code is:
>
> <snip>
>
> for anyone who may be trying to accomplish the same thing as me. In
> addition I edited index.php in the themes folder and added a php
> clause such that in the event the user is anonymous they are
> redirected to the autologin.php script and I also edited the
> register.php themes script to omit the UserCP password field and
> password confirmation since everyone in this setup is assigned one
> long random password (the thought being that the kerberos
> username/password is enough to worry about, there should be no need to
> worry about another username/password).

I almost forgot, I resolved the blank page issue by looking at the
.htaccess file FUDforum installed in its main public directory
...turns out the file contained a directive which suppressed all php
errors even when the value was specified differently in individual php
scripts, modifying that directive to show all php errors resolved that
issue.


--
Best Regards,

John Musbach

--- End Message ---
--- Begin Message ---
On Dec 26, 2008, at 1:52 PM, Nathan Rixham wrote:

Jeff Weinberger wrote:
I don't know if this is an Apache (httpd) or a PHP issue (I suspect PHP, but I may be doing something wrong with mod_suexec), so I hope this is the right place to ask. I certainly appreciate any help anyone can offer! I am trying to get a PHP script to read a file that's outside the DocumentRoot of a VirtualHost, in fact well outside the parent directory of all of my virtual hosts. I have successfully managed to get Apache httpd to run the script as the correct user and group (matching the target file's ownership) using SuexecUserGroup. I tested this by having the script create/write a test file, which had owner and group set correctly. However, when I run the script, at the file("/path/to/target/file") command, PHP tells me it can't open the file - permission is denied.
In php.ini safe_mode is off and open_basedir is not set.
I am not sure where else to look for a solution - any help is very much appreciated! FYI: PHP 5.2.6, Apache httpd 2.2.11, mod_ssl/2.2.11, OpenSSL/0.9.7l on Mac OS/X 10.5.5. I'm reaching the script over an SSL (https) connection if that matters).
Thanks!

do what it takes to make it work (ie chmod 777 or similar) then put things back to how they presently are one by one to find the cause of the error. :)

Nathan: Thanks for your suggestion - a good debugging step - but the permissions on the file I want the script to read have been -rw-rw-rw- the entire time.

This leads me to suspect that the issue is not the permissions themselves, but rather something about my PHP configuration or script (or, possibly, as I noted, my Apache httpd configuration) that is causing PHP to report a permission error on reading the file.

I don't know where else to look for this issue, so I hope that someone has at least some pointers or suggestions on what might be happening here.

Thank you very much for any help!

--- End Message ---
--- Begin Message ---
there are many php related files.

yumex or yum don't seem to be alternatives since there are many files that may 
or may not require updating...which one

yum remove php-5.2.6
yum install php-5.2.8

5.2.8 may not be in the repositories yet

so rpm seems to be an alternative with a remove - reinstall


      


--- End Message ---
--- Begin Message ---
Lately I've been hearing a lot of people evangelizing that PHP with
Resin is actually much faster than with mod_php, but I cannot find any
benchmark anywhere.

Is it true or just vendor BS?

--- End Message ---
--- Begin Message ---
On Dec 27, 2008, at 3:31 PM, "John Papas" <jspa...@gmail.com> wrote:

Lately I've been hearing a lot of people evangelizing that PHP with
Resin is actually much faster than with mod_php, but I cannot find any
benchmark anywhere.

well of course it is, but faster than what.., regular php. Be the jvm; what do you see..? Native caching support, and that's where you'll find the main speed advantage. but we in the C php camp just use opcode caching and pretty much account for that difference pretty easily.

Is it true or just vendor BS?

lots of projects have started using the jvm b/c it's a wicked fast cross platform solution. there are plenty of ways to make php fast though, and when comparing the standard php impl to quercus, I think the other tradeoffs outweigh any performance discrepancies.

-nathan

--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 12:56 PM, phphelp -- kbk <phph...@comcast.net>wrote:

> On Dec 26, 2008, at 7:53 PM, Larry Garfield wrote:
>
>  I have an object to which I want to add behavior (methods).  I cannot use
>> inheritance here because the object is already of a type or subtype (vis,
>> I am
>> already using inheritance for something else), and because I want to be
>> able
>> to add multiple types of behavior at runtime.
>>
>
> If I understand what you are wanting to accomplish, perhaps a simpler
> solution:
>
> Whenever I create a function in a core-level class, I add pre- and post-
> execution language to it. For example:
>
> class foo_bar {
>
>  function foo () {
>    if (!on_foo()) {
>     return FALSE;
>    }
>    // normal foo code
>    // normal foo code
>    // normal foo code
>    // normal foo code
>    // normal foo code
>    if (!more_foo()) {
>     return FALSE;
>    }
>  }
>
>  function on_foo() {
>    return TRUE;
>  }
>
>  function more_foo() {
>    return TRUE;
>  }
> }
>
> -- then in the child class:
> class child_bar extends foo_bar {
>
>  function on_foo() {
>  // runtime code
>  // runtime code
>  // runtime code
>  // runtime code
>  return TRUE; // (or FALSE)
>  }
> }


more commonly referred to as  the template method.

-nathan

--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 12:35 PM, Larry Garfield <la...@garfieldtech.com>wrote:

> On Saturday 27 December 2008 2:49:22 am Nathan Nobbe wrote:
>
> > > Thanks, Nathan.  Unfortunately, what you describe is impossible.  It
> > > requires
> > > me to know all the possible decorators ahead of time and implement the
> > > interface for each in each decorator, at which point I've gotten no
> > > benefit at
> > > all over just putting everything in the original base class in the
> first
> > > place.
> > > That defeats the purpose of decorators if I can't come up with a new
> one
> > > a month from now and not have to modify any of the existing code.
> >
> > i see it more on a need-to-expose basis.  for example, why not, when
> > presented w/ the current problem, just expose, Baz::doThings() now, b/c
> you
> > know you need it in Baz instances ?  later if you find theres another
> > method thats in Bar that isnt yet exposed, you just go in and add a
> similar
> > wrapper for it in Baz at that time.  this is a typical flow in a layered
> > architecture in my experience; often times controllers are revised to
> > expose a new entry point for something on the backend that previously was
> > unavailble from the front end, just as an example.
>
> Because this is for a shipping application, not an in-house app where a
> month
> from now I can go back and adjust the interface for every class.  (It's
> open
> source, but still has a stable release version.)  I need to be able to add
> additional wrapping decorators *without* any modifications to the
> underlying
> object or its interfaces.


then you can expose all methods from the underlying layer in the first place
(which is basically what happens w/ inheritence, as i mentioned earlier).
also, how bad will it be when a month from now you have to make some
adjustments to the code?  more than likely after the first cut, you may have
to change something in more than one layer, but it should be minimal as long
as you arent making any major overhauls to the code.  you add or change one
method in a lower, layer so you need to change it in another place, one
layer above, i dont see that being so bad.  what you are worried about is
the classic case martin fowler put forth, which is a short coming of a
layered architecture, namely, in the worst case scenario, a modification at
the lowest layer requires modifications to each successive layer.


> As I said, the interface problem is solvable by having explicit delegating
> methods in the base decorator class and then only using __call() for nested
> decorators, which will be a much much smaller portion of the time.  It's
> the
> performance cost of __call() and the extra call stack layers that are my
> concern at the moment.


there is one semi-micro optimization w/ __call(), and that is to use a
variable function rather than call_user_func*.  however, as you surely
already know, this only works iff you know the number of parameters that
need to be passed intot the function which is being wrapped.  something like
this,

function __call($method, $args) {
  return $this->foo->$method($args[0], $args[1]);
}

the performance hit from __call() is just the price for a highly dynamic
system; but you can have a faster system, at the slight risk of
carpel-tunnel :)

-nathan

--- End Message ---
--- Begin Message ---
Hey,

How do you structure your web applications? I am thinking in terms of separating presentation and logic. How is that done in PHP? And how many architecture patterns are there?


Thanks


Micheal C. Yates


--- End Message ---
--- Begin Message ---
On Sat, Dec 27, 2008 at 18:40, Michael C. Yates <quw...@gmail.com> wrote:
[snip!]
>
> Micheal C. Yates

    You mis-spelled your name, Michael.

-- 
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--- End Message ---
--- Begin Message ---
On Sat, 2008-12-27 at 19:00 -0500, Daniel Brown wrote:
> On Sat, Dec 27, 2008 at 18:40, Michael C. Yates <quw...@gmail.com> wrote:
> [snip!]
> >
> > Micheal C. Yates
> 
>     You mis-spelled your name, Michael.
> 
> -- 
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Unadvertised dedicated server deals, too low to print - email me to find out!
> 
Lol! Epic spelling fail?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
dude, whatever....


Daniel Brown wrote:
On Sat, Dec 27, 2008 at 18:40, Michael C. Yates <quw...@gmail.com> wrote:
[snip!]
Micheal C. Yates

    You mis-spelled your name, Michael.


--- End Message ---
--- Begin Message ---


Hey,

How do you structure your web applications? I am thinking in terms of separating presentation and logic. How is that done in PHP?

mvc is pretty popular, but php is so flexible you often don't need it for smaller applications.

For example, if you take a page-controller approach, a php app is dead simple. You have a seperate entery point for evrything; login.php, register.php, etc could be considered controllers, then all your common logic comes in via some includes, hopefully files outside the webroot. then you have some template directory w/ files that are a mixture of php and html(for example). your 'controller' files include the library code, hit the db (if necc.) and then stuff data into the templates for output.

if you want to see an exmple if a more traditional mvc there are scads of open source frameworks out there which use a front controller approach. Code igniter is really straight forward, you can probly learn quickly from it.

And how many architecture patterns are there?

please do try to avoid pandoras box on the list ;) It can result in 100+ post threads, heh. that being said patterns are pretty general things, that's why they're called patterns. most of the time various languages will result in slightly different concrete realizations of a pattern, but you'll find most of them rather simple to realize in php. One that really isn't well suited to phps build-up / tear-down paradigm is the state pattern. much easier in java or cpp, imo.

-nathan

--- End Message ---
--- Begin Message ---
I'm interested in this topic as well. I'm starting out on a reasonably large
web application, and I'm wondering at the best approach in PHP, particularly
since it's been some years since I worked with PHP on a daily basis (the
last 5 years have been purely C#).

There's some dev community bias against using frameworks, isn't there? On
one hand I'd love to take an approach that would make my end goal easier
(thanks for pointing out Code Igniter, I'll look into it further), but on
the other hand I'd rather avoid choices that 'tainted' (perhaps not the
right word, but the best I could think of) the overall acceptance of the
application once it's ready for release.

So, currently I'm wondering about things like, 'Do I make an app that is a
distinct page-per-function, or do I make an app that uses a monolithic
index.php (similar to Wordpress?) and dynamically presents
*everything*based on querystring values.'

M is for Murray


On Sun, Dec 28, 2008 at 10:05 AM, Nathan Nobbe <quickshif...@gmail.com>wrote:

>
>
>  Hey,
>>
>> How do you structure your web applications? I am thinking in terms of
>> separating presentation  and logic. How is that done in PHP?
>>
>
> mvc is pretty popular, but php is so flexible you often don't need it for
> smaller applications.
>
> For example, if you take a page-controller approach, a php app is dead
> simple.  You have a seperate entery point for evrything; login.php,
> register.php, etc could be considered controllers, then all your common
> logic comes in via some includes, hopefully files outside the webroot.  then
> you have some template directory w/ files that are a mixture of php and
> html(for example).  your 'controller' files include the library code, hit
> the db (if necc.) and then stuff data into the templates for output.
>
> if you want to see an exmple if a more traditional mvc there are scads of
> open source frameworks out there which use a front controller approach. Code
> igniter is really straight forward, you can probly learn quickly from it.
>
>  And how many architecture patterns are there?
>>
>
> please do try to avoid pandoras box on the list ;)  It can result in 100+
> post threads, heh.  that being said patterns are pretty general things,
> that's why they're called patterns.  most of the time various languages will
> result in slightly different concrete realizations of a pattern, but you'll
> find most of them rather simple to realize in php.  One that really isn't
> well suited to phps build-up / tear-down paradigm is the state pattern.
>  much easier in java or cpp, imo.
>
> -nathan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Saturday 27 December 2008 6:57:18 pm Murray wrote:
> I'm interested in this topic as well. I'm starting out on a reasonably
> large web application, and I'm wondering at the best approach in PHP,
> particularly since it's been some years since I worked with PHP on a daily
> basis (the last 5 years have been purely C#).
>
> There's some dev community bias against using frameworks, isn't there? On
> one hand I'd love to take an approach that would make my end goal easier
> (thanks for pointing out Code Igniter, I'll look into it further), but on
> the other hand I'd rather avoid choices that 'tainted' (perhaps not the
> right word, but the best I could think of) the overall acceptance of the
> application once it's ready for release.
>
> So, currently I'm wondering about things like, 'Do I make an app that is a
> distinct page-per-function, or do I make an app that uses a monolithic
> index.php (similar to Wordpress?) and dynamically presents
> *everything*based on querystring values.'
>
> M is for Murray

There are exactly 47 architectural patterns, not a single more or less.  And 
if you believe that, I have a bridge you may be interested in. :-)

Seriously though, you'll probably find an existing implementation of any 
architectural pattern in PHP, including the ones that have absolutely no 
business being implemented in PHP.  (I include MVC in that, actually[1].)

If you really want to know about OO patterns, pick up the Gang-of-Four book[2] 
and spend some time wrapping your head around it.  (Warning: It is written 
mostly for a C++ audience, but it's still understandable.)  Then ignore those 
patterns that require more setup effort on each execution than they take to 
run, as those are ill-suited to PHP's shared-nothing architecture.  An active 
Observer, for instance, really sucks in a web app but a passive observer can 
do great things.

Then, get over your OO biases. :-)  PHP can do functions just as well as OO, 
and because of the setup costs in "proper" OO doing things with functions can 
often be much faster and require less mental overhead than building out a full 
OO setup.  There are plenty of major projects (PHP and otherwise) that use 
virtually no OO and still manage to kick ass.  (Drupal comes to mind, and the 
Linux kernel itself is all C code, which doesn't have syntactic OO.)  Don't 
assume that architecture just means OO.

Page-per-action vs. a front controller (the index.php to rule them all, 
usually with mod_rewrite) depends on your app and how you want to extend it.  
I personally far prefer a front controller approach as it means I can abstract 
out the bootstrap code and not even have the "include this at the top of every 
page" stuff.  It does mean you want mod_rewrite if your app is going to be at 
all bookmarkable or googleable (you may or may not want it to be), but that's 
not a huge requirement.

Disclaimer: I was asking this same question about 3-4 years ago, and started 
looking for PHP systems to study to learn from.  I found Drupal, started using 
it directly, and haven't left yet. :-)  That's probably not a bad approach to 
take.  Find an existing system that "feels right" to you and run with that.  
You'll almost certainly get a better system out of it than trying to write 
everything yourself.  (I've done that before, too, and it was generally a 
disaster.)

[1] http://www.garfieldtech.com/blog/mvc-vs-pac
[2] http://en.wikipedia.org/wiki/Gang_of_Four_(software)

-- 
Larry Garfield
la...@garfieldtech.com

--- End Message ---
--- Begin Message --- I think there is a lot to be gained from using a framework. I have an extremely large web app in asp ( over 1500 pages ) and maintenance is a frigging nightmare as it's so imtertwined.

Using the code ignitor framework reduces that dramatically and I now have 5 rules based classes that control the majority of the app with the rest of the code being mainly basic crud and validation.

The code is much cleaner, way simpler to maintain and the mvc pattern makes changes and additions a breeze.

Sorry for top posting, ipod seems to prefer that for it's mail setup

My 2 cents, though it's worth looking at other frameworks like qcodo, cake, or send to pick the flavor that fits you best

Bastien

Sent from my iPod

On Dec 27, 2008, at 7:57 PM, Murray <planetthought...@gmail.com> wrote:

I'm interested in this topic as well. I'm starting out on a reasonably large web application, and I'm wondering at the best approach in PHP, particularly since it's been some years since I worked with PHP on a daily basis (the
last 5 years have been purely C#).

There's some dev community bias against using frameworks, isn't there? On one hand I'd love to take an approach that would make my end goal easier (thanks for pointing out Code Igniter, I'll look into it further), but on the other hand I'd rather avoid choices that 'tainted' (perhaps not the right word, but the best I could think of) the overall acceptance of the
application once it's ready for release.

So, currently I'm wondering about things like, 'Do I make an app that is a
distinct page-per-function, or do I make an app that uses a monolithic
index.php (similar to Wordpress?) and dynamically presents
*everything*based on querystring values.'

M is for Murray


On Sun, Dec 28, 2008 at 10:05 AM, Nathan Nobbe <quickshif...@gmail.com>wrote:



Hey,

How do you structure your web applications? I am thinking in terms of
separating presentation  and logic. How is that done in PHP?


mvc is pretty popular, but php is so flexible you often don't need it for
smaller applications.

For example, if you take a page-controller approach, a php app is dead
simple.  You have a seperate entery point for evrything; login.php,
register.php, etc could be considered controllers, then all your common logic comes in via some includes, hopefully files outside the webroot. then you have some template directory w/ files that are a mixture of php and html(for example). your 'controller' files include the library code, hit
the db (if necc.) and then stuff data into the templates for output.

if you want to see an exmple if a more traditional mvc there are scads of open source frameworks out there which use a front controller approach. Code igniter is really straight forward, you can probly learn quickly from it.

And how many architecture patterns are there?


please do try to avoid pandoras box on the list ;) It can result in 100+ post threads, heh. that being said patterns are pretty general things, that's why they're called patterns. most of the time various languages will result in slightly different concrete realizations of a pattern, but you'll find most of them rather simple to realize in php. One that really isn't well suited to phps build-up / tear-down paradigm is the state pattern.
much easier in java or cpp, imo.

-nathan


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



--- End Message ---
--- Begin Message ---
on page 1
Notice: Undefined index: in C:\Inetpub\wwwroot\handle_log_book_MySQL.php on 
line 71

Notice: Undefined index: in C:\Inetpub\wwwroot\handle_log_book_MySQL.php on 
line 72

in php.ini:

error_reporting  =  Off

display_errors = Off (in 2 places)

display_startup_errors = Off





      


--- End Message ---
--- Begin Message ---
On Sat, 2008-12-27 at 16:23 -0800, Fred Silsbee wrote:
> on page 1
> Notice: Undefined index: in C:\Inetpub\wwwroot\handle_log_book_MySQL.php on 
> line 71
> 
> Notice: Undefined index: in C:\Inetpub\wwwroot\handle_log_book_MySQL.php on 
> line 72
> 
> in php.ini:
> 
> error_reporting  =  Off
> 
> display_errors = Off (in 2 places)
> 
> display_startup_errors = Off
> 
> 
> 
> 
> 
>       
> 
> 
What does phpinfo() tell you? Don't forget that there are several places
where this can be set; the php.ini file, the .htaccess file, and within
the PHP code itself. If phpinfo() tells you that both settings are for
errors off, then it's most likely that a line in your PHP code is
turning them back on


Ash
www.ashleysheridan.co.uk


--- End Message ---

Reply via email to