Environment Setup FAQ

Instructions for setting up programming language runtimes for various environments.

Learnosity can be used with any serverside language. Addtionally, we have created language specific Native SDK Integrations for PHP, Java, .Net, Python, Ruby, Node.js. These allow you get going faster with our services.

The following environment guides will be expanded over time. They are generic and there are no specific requirements for Learnosity use within your environment, beyond the inclusion of our SDK mentioned above.

PHP

PHP comes preinstalled on Mac OS X, so no install is required, and you can run PHP immediately by opening the Console and typing php -S localhost:8000. The folder where you run that command will be treated as the web root.

  1. From the command line, run sudo apt install php and enter your password.
  2. The latest version of PHP will be installed.
Create your Hello World PHP file

Create a new www folder in your ~/Public directory. You can do this from the command line using mkdir ~/Public/www.

Open a blank text file, copy-paste the following sample, and save it to ~/Public/www/hello.php.

<html>
    <head>
        <title>PHP Test</title>
    </head>
    <body>
        <?php echo '<p>Hello World</p>'; ?>
    </body>
</html>

This hello world example is from the PHP documentation.

Start your PHP server

PHP comes with its own rudimentary web server, which can be used for development and testing. To start the server:

  1. From the command line, navigate to /Documents/www
  2. Run the following command: php -S localhost:8000. You should see output like this:
lrn$ php -S localhost:8000
PHP 7.1.11 Development Server started at $date, $time
Listening on http://localhost:8000
Document root is ~/Public/www
Press Ctrl-C to quit.
Test your PHP server
  1. Point your web browser to http://localhost:8000/hello.php.
  2. A plain web page with “Hello World” at the top should appear. If so, your PHP server is working. If not, follow the Linux troubleshooting instructions in the PHP documentation.
  3. Setup complete.

Install PHP and the Microsoft Visual C libraries

Below, choose a version of PHP, either 5.6 or 7.1.
Installing PHP 5.6
  1. Go to the official PHP site, select PHP 5.6 and download the PHP 5.6 zip file from this page.
  2. Download the file: VC11 x86 Thread Safe, choosing the Zip archive format.
  3. Extract the contents to a new folder, “C:\php”. Ensure that “php.exe” is at the top level of this folder.
  4. We will now install some library files needed for PHP 5.6, in this case the Visual C++ Redistributable for Visual Studio 2012 Update 4. Visit the official Microsoft site for this file and click Download.
  5. When prompted to choose a file to install, select “vc_redist.x86.exe” and click “Next”. The download will begin. Once the download is complete, save the file to disk, then then run the installer.
  6. Once the installer has completed, move on to the next step, “Adding the PHP Folder to the Windows Environment Variables”.
Installing PHP 7.1
  1. Go to the official PHP site, select PHP 7.1 and download the PHP 7.1 zip file from this page.
  2. Download the file: VC14 x86 Thread Safe, choosing the Zip archive format.
  3. Extract the contents to a new folder, for example, C:\php. Ensure that php.exe is at the top level of this folder.
  4. We will now install some library files needed for PHP 7.1, in this case Visual C++ Redistributable for Visual Studio 2015. Visit the official Microsoft site for this file and click Download.
  5. When prompted to choose a file to install, select vc_redist.x86.exe and click Next. The download will begin. Once the download is complete, save the file to disk, then then run the installer.
  6. Once the installer has completed, move on to the next step.
Adding the PHP folder to the Windows path environment variable
  1. Go to Start > Settings. In the Settings dialog, type environment variables into the search bar. Click Edit the System Environment Variables. The System Properties dialog appears.
  2. Click the Environment Variables button. The Environment Variables dialog appears.
  3. Select the Path variable under System variables in the lower half of the window and then click Edit.The Edit environment variable dialog appears.
  4. Append ;C:\php to the path variable. Click Ok to confirm.
  5. Click Ok on the Environment Variables dialog.
  6. Restart any open command line windows for the new settings to take effect.
Create your PHP “Hello World” file
  1. Create a new www folder on your hard drive, for example, at C:\www.
  2. Open a blank text file, copy-paste the following sample, and save it to C:\www\hello.php:
<html>
    <head>
        <title>PHP Test</title>
    </head>
    <body>
        <?php echo '<p>Hello World</p>'; ?>
    </body>
</html>

Note Ensure that hello.php has not been named hello.php.txt by your text editor. If it has, rename it to hello.php. This hello world example is from the PHP documentation.
Start your PHP server
PHP comes with its own rudimentary web server, which can be used for development and testing. To start the server:
  1. Open the Command Prompt then navigate to C:\www.
  2. Run the following command: php -S localhost:8000
    You should see output like this:
C:\www> php -S localhost:8000
PHP 7.1.11 Development Server started at $date, $time
Listening on http://localhost:8000
Document root is C:\www
Press Ctrl-C to quit.
Test your PHP server
  1. Point your web browser to http://localhost:8000/hello.php.
  2. If your PHP server is working, a plain white page with “Hello World” at the top should appear. If not, follow the troubleshooting instructions on the PHP site.
  3. Setup complete!