PHP Setup

PHP Setup Instructions From InventoryInstallation

Installing LAMP

LAMP stands for "Linux, Apache, MySQL, and PHP". It is a bottom-to-top suite of technologies for developing and running web applications.

Once you have Linux set up on your workstation, the simplest way to install Apache, MySQL, and PHP is:

For version 14.04:

  1. Press Ctrl-Alt-T to open a terminal on the Linux workstation.
  2. Enter this command at the command line:
    sudo apt-get install -f apache2 php5 apache2-utils libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql php5-curl phpmyadmin
  3. When prompted to authorize the disk space allocation, enter Y.
  4. When asked for a MySQL administrative password, enter a strong one and make sure you remember it. Enter it again to confirm it. Because of the power that this password confers, it is advisable not to make it the same as your WatIAM password. For the moment, write it down, as you'll need it later in this process.
    MySQL Administrative Password:                         
  5. When asked which web server to configure to run phpMyAdmin, select apache2. (Use the up- and down-arrow keys to move among options and press Enter to select.)
    Screen shot: choosing a web server to run phpMyAdmin
  6. When asked whether you want to configure dbconfig-common as the database for phpMyAdmin, select Yes.
    Screen shot: letting dbconfig-common configure a database for phpMyAdmin
  7. When asked for a password for phpMyAdmin to register with the database server, enter a strong one. (It can be same as the one you chose in step 4 above.) Enter it again to confirm it. For the moment, write it down, as you'll need it later in this process.
    phpMyAdmin root Password:                         

For version 16.04:

Ubuntu 16.04 LTS comes with php7. We are currently using PHP 7.0 on the production webserver, so if you find other instructions saying to use a different version of PHP, they will have to be modified to use PHP7.0.

  1. Enter the following commands in terminal to install apache, mysql and phpmyadmin:
    sudo apt-get install apache2 mysql-server mysql-client phpmyadmin
  2. Enter the following commands in order to install some phpmyadmin extensions:
    sudo apt-get install php-mbstring php-gettext

For version 18.04:

Setting up 18.04 is similar to 16.04. 18.04 comes with PHP 7.2.

  1. Enter the following commands in terminal to install apache, mysql and phpmyadmin:
    sudo apt-get install apache2 mysql-server mysql-client phpmyadmin

Then you will need to follow steps 5 through 7 from 14.04 instructions

  1. Enter the following commands in order to install some phpmyadmin extensions:
    sudo apt-get install php-mbstring php-gettext

Installing Git

Git is a distributed version control system. The Inventory software is kept in the campus Git repository. Before you can get a copy of the Inventory software from the repository, you will need to install the Git software. Follow these steps.

  1. At a Linux command prompt, enter:
    sudo apt-get install git
  2. When asked for the sudo password, enter it.
  3. When warned about the disk space requirement, enter Y to continue.
  4. If you have not used Git before on your workstation, you may not have SSH keys configured. Follow the instructions found here to generate and add an SSH key to your Github account.
  5. To test your Git installation and your public key, enter this command:
    git ls-remote --exit-code -h gitlab@git.uwaterloo.ca:cscf/odyssey-documentation.git
    • If you get a prompt similar to this:
      The authenticity of host 'git.uwaterloo.ca (129.97.83.16)' can't be established.
        RSA key fingerprint is b9:6a:a9:3b:f6:d3:36:19:89:f6:0f:3d:2e:6c:a8:e2.
        Are you sure you want to continue connecting (yes/no)?

      …enter yes.
    • If the test is successful, you should see a line something like this one.
      f24d26dc066e287c9c38fff6c4d7bd52c816ea1e   refs/heads/master
  6. Configure your identity in Git:
    git config --global user.name "Joe Schmoe" (Use your name.)
    git config --global user.email "jschmoe@uwaterloo.ca" (Use your e-mail address.)

IDE and Debugging Environment Recommendations from Chris Gravel

Sublime

  • Use sublime editor for Ubuntu for an excellent and highly customizable text editor. (Installation instructions here: http://askubuntu.com/questions/172698/how-do-i-install-sublime-text-2-3).
  • Install package control from here: https://packagecontrol.io/installation
  • Setup XDebug for Sublime editor to have a live PHP debugging environment.
  • Follow XDebug instructions here: http://www.sitepoint.com/debugging-xdebug-sublime-text-3/
  • Once enabled, you just need to start an XDebugging session in Sublime and then include the line "?XDEBUG_SESSION_START=sublime.xdebug" after the URL address of your page.
  • There is an error in the default setup of XDebug in Linux which can easily be fixed. To fix it, first open Sublime editor and after installing Xdebug as described above, click on Tools > Xdebug > Settings - default (notice this document is not editable). Now select everything, copy it and paste it into a new document on your desktop titled "Xdebug.sublime-settings". Now create the directory "~/.config/sublime-text-3/Packages/Xdebug Client" and move the created file into there so its full path is "~/.config/sublime-text-3/Packages/Xdebug Client/Xdebug.sublime-settings". Now you can edit settings by going into Sublime editor and then Tools > Xdebug > Settings - default and then editing the settings accordingly followed by saving the changes. I suggest immediately changing the "max_depth" value to 3 in order to view nested arrays. That's it.

-- Kyra McEllistrum - 2020-03-09

Comments

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2020-04-23 - KyraMcEllistrum
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback