Forum Moderators: coopster

Message Too Old, No Replies

Managing & controlling large PHP site

         

aspr1n

5:29 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



Hi all,

I am about to embark on a very PHP intensive site, and much of the code will be nothing to do with outputing any HTML, so I'd like to abstract the PHP as much as possible from both the xhtml & css.

Any thoughts on management of all this would be appreciated, and also if there is anyway to protect my code?

Cheers,

daisho

5:35 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



That's a fairly broad question. Not sure if it can be answered without some more details.

Regarding protecting code there is a product from a company called IONCube that will compile PHP. Also you have the Zend commercial tools that will do much the same. Zend may be a little more trusted since they make the PHP engine but their price tag is higher.

daisho

dmorison

5:59 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When developing in PHP, I tend to code functions into small library files which are located outside of the "wwwroot" tree.

For example, my database library is included with:

require("/phplib/db/db.inc");

Misc. HTML functions are included with

require("/phplib/html/html.inc");

etc. etc.

By only including libraries on pages that require that functionality (much like #include within C programs) you keep the total code size down to a minimum for each page.

I doubt that this provides "protection" in the way you mean - but at least it would prevent critical code being served as raw PHP if, for example, a sysadmin upgraded your web server and messed up the CGI handling config!

ruserious

6:03 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



>so I'd like to abstract the PHP as much as possible from
>both the xhtml & css.

That looks like a call for a templating system. There are quite a few ones available. Personally I think its mostly a matter of taste. I'd go with Smarty, though.

As far as protection: From whom do you want to protect the code?

@dmorison: Using include-files, and putting them outside is a very good idea. I can only agree to it! It will also lessen the chance of somebody trying to "fiddle" with your site by trying to make use of uninitialized variables (although, usually register globals is off anyhow, nowadays...)

aspr1n

6:47 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



Thanks guys, I was going down the library line of thinking - the external library idea will be very useful, and I am now intrigued by this templating system - thanks.

As far as protection: From whom do you want to protect the code?

Err... that'll be the end users and the company it's being written for - I don't trust either of them much ;)

thanks

asp

dmorison

7:00 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Err... that'll be the end users and the company it's being written for - I don't trust either of them much ;)

You should have a look at this - it might be worth your investment if protecting your PHP Intellectual Property is a requirement:

[zend.com...]

Zend are intrinsically linked with PHP so I think i'm safe posting that here!

aspr1n

12:09 am on Apr 30, 2003 (gmt 0)

10+ Year Member



yeah - great link thanks, they do a small business edition which would probably do us fine.

Cheers,

asp