Php – How to enable PHP features without recompiling

PHP

I want to use semaphore functions. The installation instructions reads

Support for this functions are not enabled by default. To enable System V semaphore support compile PHP with the option –enable-sysvsem . To enable the System V shared memory support compile PHP with the option –enable-sysvshm . To enable the System V messages support compile PHP with the option –enable-sysvmsg .

But I'm running XAMPP for Linux. Does this mean it's impossible for me to use semaphore functions? I'd also like to know exactly why one has to recompile all of PHP instead of, say, tweaking a php.ini setting or adding a new module.

Best Answer

But I'm running XAMPP for Linux. Does this mean it's impossible for me to use semaphore functions?

No not at all, you only need to get a version of XAMPP that has the extension available. Alternatively you can compile PHP yourself.

I'd also like to know exactly why one has to recompile all of PHP instead of, say, tweaking a php.ini setting or adding a new module.

Because the modules sources are part of PHP sources. You then compile everything into the PHP binary and not into a shared library file. It's just the design of the module. For tweaking your php.ini as you coin it, you would need an external library file, see the PHP ext directory.