1

I'm going to buy a (cheap) hosting space with apache/php 5/mysql. Because it's cheap i have no direct control over php.ini and extension loading.

My question is: can i load an extension putting the .dll file into my space and than using dl() php function? Can the host disable this feature thus avoid loading custom extension this way?

j0k
  • 22,600
  • 28
  • 79
  • 90
gremo
  • 47,186
  • 75
  • 257
  • 421
  • If the `extension_loaded()` function works as I assume it does from reading the docs, you could attempt to load the extension using `dl()` and then check that it has become available using `if (!extension_loaded([EXTENSION])) { echo "Failed to load extension"; exit(); }` and then you'll be able to prevent your code working if it doesn't load. Just an aside. – Luke Oct 07 '11 at 15:30
  • Gremo, take a look at https://www.alwaysdata.com/plans/shared/ They have a free plan which you can start out on, and then if you need the traffic, I'm sure their cheapest plan won't be a problem. They have been very accommodating to me. For a far less flexible option, but cheaper and very stable servers, try http://www.1and1.com/?affiliate_id=328546 – Levi Morrison Oct 07 '11 at 15:52

3 Answers3

2

Yes, it can be disabled through the enable_dl and safe_mode php.ini settings (which would almost certainly be the case, as otherwise you could e.g. load your own code in the web server process).

And that's in addition to the disable_functions setting, which can disable anything.

Jon
  • 428,835
  • 81
  • 738
  • 806
  • Not exactly true that you can disable anything, for instance you can't disable [`eval`](http://php.net/manual/en/function.eval.php), sadly, because it's one of the worst and dangerous features of PHP. This is because `eval` is a language construct, not a function. – stivlo Oct 24 '11 at 17:20
0

the host can disable any function within php from the php.ini. in fact I would be surprised if the host left this feature on.

Jonathan Kuhn
  • 15,279
  • 3
  • 32
  • 43
0

Since you're talking about a .dll, you are assuming to get a Windows hosting server running PHP, however, is better that you check with the hosting company, because probably dl() will be disabled.

Smaller hosting companies can be more accommodating with adding extensions you may require.

stivlo
  • 83,644
  • 31
  • 142
  • 199