Now CWP has a PHP Switch option where you can very easily switch to other PHP versions and recompile it with desired modules.
How to use it?
- Click on PHP Version Switcher (here you will get server PHP version and compiled modules that your server has now compiled).
- Select PHP Version you wish to compile in the drop-down menu and click next.
- In PHP compiler you can add or remove modules you want.
- Click on the Start compiler and the compiler will start to work in the background.
The compiler needs from 5 to 20 minutes to finish, depending on modules you are installing and your CPU power.
You can return in eg. 15 minutes and in CWP - PHP Version Switch check which version of PHP and modules you have now.
Your websites and CWP will work during the compiler process and PHP will be updated when the compiler is completed.
You can check for PHP compile logs in the file:
If you wish to monitor compiler then use this command from the shell:
tail -f /var/log/php-rebuild.log
How to add custom build flags to php switcher?
This can be done by editing configuration files, configuration files are located here:
CentOS 7: /usr/local/cwpsrv/htdocs/resources/conf/el7/php_switcher/
CentOS 8: /usr/local/cwpsrv/htdocs/resources/conf/el8/php_switcher/
And at end of this file we add:
[shmop-test] default=0 option="--enable-shmop"
Under square brackets [shmop-test] you create the name you will use for build, must be unique and not previously defined in the file.
Under option you need to define build flags.
After editing you are ready to build your new PHP from CWP PHP switcher.
** Please note that cwp update will overwrite this files!