LoneWolfJack
June 10th, 2011, 07:22 AM
Hey guys,
I'm currently doing some preparations for an upcoming PHP project and I'd like to ask for some input.
The project calls for PHP files (call them extensions) that can't be included by the core PHP application. I can't really give much more detail here without violating the NDA, but apparently the customer wants his clients to be able to add to the core project but without enabling them to access the core files or the database directly.
To make this more complex, the extensions can't be standalone scripts that you would call like "domain.tld/extension.php".
So far, I've come up with the following solutions:
1. in fact, I DO include the extensions via some sort of module management. This would, however, only work if it is possible to restrict PHP functionality on a per-folder basis regardless of the caller file. I highly doubt this would work (in fact, restricting functions on a per directory basis doesn't work at all last time I checked).
2. build an API. It seems, however, that performance would suffer because every shell command that is passed through PHP is executed in a new shell. Some testing confirmed that we're talking about 0.05 seconds per shell command - too much to be seriously considered.
3. build a PHP extension. this should work, but given that this would have to be in C, it would really strain the budget
4. ???
So basically, I'm wondering if someone has another idea I haven't come up with yet.
I'm currently doing some preparations for an upcoming PHP project and I'd like to ask for some input.
The project calls for PHP files (call them extensions) that can't be included by the core PHP application. I can't really give much more detail here without violating the NDA, but apparently the customer wants his clients to be able to add to the core project but without enabling them to access the core files or the database directly.
To make this more complex, the extensions can't be standalone scripts that you would call like "domain.tld/extension.php".
So far, I've come up with the following solutions:
1. in fact, I DO include the extensions via some sort of module management. This would, however, only work if it is possible to restrict PHP functionality on a per-folder basis regardless of the caller file. I highly doubt this would work (in fact, restricting functions on a per directory basis doesn't work at all last time I checked).
2. build an API. It seems, however, that performance would suffer because every shell command that is passed through PHP is executed in a new shell. Some testing confirmed that we're talking about 0.05 seconds per shell command - too much to be seriously considered.
3. build a PHP extension. this should work, but given that this would have to be in C, it would really strain the budget
4. ???
So basically, I'm wondering if someone has another idea I haven't come up with yet.