Getting Started - nickpalmer789/ProductionNumber4 GitHub Wiki

Introduction:

This project uses the LAMP (Linux, Apache, MySQL, and PHP) stack. As such it is important to set up your local development environment properly so that you can develop new code without having to publish it publicly.

Install/Configure Apache and PHP

  1. Install apache2 and PHP:
    $ sudo apt-get install php libapache2-mod-php php-mcrypt

  2. Set global ServerName to suppress syntax warnings:
    a. Perform a config test
    $ sudo apche2ctl configtest
    b. Open up the config file
    $sudo vim /etc/apache2/apache2.conf
    c. Add the following line at the bottom of the file
    ServerName localhost
    d. Perform another config test
    $ sudo apache2ctl configtest
    e. If everything is working as intended, restart Apache to implement changes
    $ sudo systemctl restart apache2

  3. Adjust firewall to allow web traffic:
    a. Ensure that UFW has an application profile for Apache
    $ sudo ufw allow in "Apache Full"

  4. Test the Apache server:
    a. Get the IP address of the Apache server
    $ ip route get 1 | awk '{print $NF; exit}'
    b. Check that Apache is working as intended by going to that IP address in your browser
    c. Check that the ServerName is set correctly by typing 'localhost' into the address of your browser.

  5. Make sure that the Apache server looks for index.php instead of index.html
    a. Open up the Apache DirectoryIndex file
    $ sudo vim /etc/apache2/mods-enabled/dir.conf
    b. Modify the file so that index.php is at the beginning of the second line. Be sure to restart the server afterwards! It should look like this:

    <IfModule mod_dir.c>  
        DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm  
    </IfModule>
    
⚠️ **GitHub.com Fallback** ⚠️