note 40911 deleted from function.dl by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Jul 2008 23:37:51 +0000 |
| Subject: | note 40911 deleted from function.dl by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141798@lists.php.net to get a copy of this message | ||
Note Submitter: nutbar at innocent dot com
----
For those who are tearing their hair out due to the extension_dir being set to "./",
here's a somewhat graceful fix that will be portable:
dl(preg_replace('/\/([^\/]+)/', '../', dirname(__FILE__)) . __FILE__ .
'/../some/path/dll.so');
You could alternatively make that preg_replace part into a separate function and call it something
like dirname_rel() or whatever. It basically replaces all the path components with ".."
and spits out a relative path, so that when mixed with the "./" part of the extension_dir
setting, it puts you at the root folder "/" so that you know where you are :)