Here’s a Bash script that can help optimize and secure PHP for Wordpress on Linux (Tested on CentOS 8 and 9. The script will also discover the server specifications to optimize the results. Each section of the code is commented to explain what it does. Please note that this script assumes you have root access to the server.