To configure Apache to use PHP, you’ll need to install both Apache and PHP packages. Once done, you can follow these steps:
1. Open the `httpd.conf` file.
On Unix/Linux: \`\`\` vi /usr/local/apache2/conf/httpd.conf \`\`\` On Windows: `Notepad C:\Program Files\Apache Group\Apache2\conf\httpd.conf`1. Search for the section in `httpd.conf` where there are a bunch of `LoadModule` statements. You should add this line for PHP 7:
On Unix/Linux: \`\`\` LoadModule php7\_module lib64/httpd/modules/libphp7.so \`\`\` On Windows: \`\`\` LoadModule php7\_module “c:/php/php7apache2.dll“ \`\`\` Make sure the path to the .so or .dll file is correct. It should be the full path from the root, not relative to the ServerRoot.1. Look for this part and add a new line:
On Unix/Linux: \`\`\`1. You also need to add the path of PHP in system environment variables.
On Unix/Linux: \`\`\` export PATH=/usr/local/php:$PATH \`\`\` Windows: - Right-click on ‘My Computer’ and click ‘Properties’. - Click on ‘Advanced System Settings’. - Click on ‘Environment Variables’. - Under ‘System Variables’, click ‘New’ and in the ‘Variable name’ field, enter ‘PHPRC’. In the ‘Variable value’ field, enter ‘c:\php’. - Select ‘Path’ under ‘System Variables’, and click on ‘Edit’, and then ‘New’. Add ‘c:\php;’.1. Finally, restart your Apache server.
On Unix/Linux: \`\`\` /usr/local/apache2/bin/apachectl restart \`\`\` On Windows, you can do this through the Apache Service Monitor, or by going into the Services interface in the Windows Control Panel.After following all these steps, Apache should now be configured to use PHP.