0

There are a lot of posts on the internet explaining how to configure a LAMP environment but there are very few articles describing how to configure an existing Apache server to use PHP, considering that Apache is already installed at another location then the default one.

Such a scenario I encountered in the case of an AWS Lightsail Node.js stack which came with Apache installed but no PHP module configured.

Does anyone have any idea how to configure an existing Apache installation to work with PHP?

1 Answer 1

2

After doing some research I've found the necessary steps to do the configuration (for Ubuntu):

  1. Run sudo apt-get update to get the newest list of available software packages
  2. Install PHP by runing:
sudo apt-get install php libapache2-mod-php
  1. Run sudo find / -name libphp* to get the location of the libphpX.X.so file
  2. Copy the libphpX.X.so file into the Apache modules folder
  3. Open the Apache httpd.conf file and add at the end the following lines:
<FilesMatch \.php$>
    ​SetHandler application/x-httpd-php
​</FilesMatch>
  1. Restart apache server
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.