Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: AMF Moodle.

AMF Moodle

From MoodleDocs

What is AMFPHP?

AMFPHP is a widely used open source remoting server that allows Flash and Flex client-side applications to call PHP methods directly, as if they were native Flash/Flex ActionScript methods. It is fast and lightweight and presents a very efficient method of communicating with PHP and databases. AMFPHP preserves the following data types between ActionScript and PHP:

  • int
  • Number
  • String
  • Array
  • mysql_result/Recordset

Note: Please add to this list if you have successfully tested data types using AMFPHP 1.9.beta+ and ActionScript 3.0.

AMFPHP automatically converts data types between ActionScript and PHP to their native equivalents. For example, it can convert a PHP array into and ActionScript array or a PHP resource, such as a mysql_result into an Actionscript Recordset.

What is AMF Moodle?

AMF Moodle is a new project (9th October 2008) which aims to integrate Flash and Flex with Moodle's API. The aim is to build a library of services that Flash and Flex developers can use to create secure client-side applications that can interact with Moodle. The first step will be to create a Moodle module that facilitates deploying custom made, generic Flash and Flex e-learning interactions and recording user interaction results in the Moodle gradebook.

The project's participants at the moment are: Matt Bury, Jamie Pratt and Marcus Potter. You can find the project home page at code.google.com.

Installing AMFPHP in Moodle

  • Download the latest version of AMFPHP, currently version 1.9.beta (SourceForge repository).
  • Unzip the file and find the directory amfphp.
  • Upload the amfphp directory to http://***MOODLEROOT***/lib/
  • That's it!

Please note: AMFPHP requires PHP 5 to run. Many servers run both PHP 4 and 5, but have them set to run PHP 4 by default. If you experience problems, you may have to change the default PHP version in the http://***MOODLEROOT***/lib/amfphp/ directory with an .htaccess file. The following is an example only. Please check that it is correct for your server configuration. If you have a hosted server, they'll probably have an example in their help files. For example:

<nav>#If you're working with a server which doesn't seem to display errors and you don't

  1. have access to httpd.conf and you have a good reason to develop remotely instead of
  2. locally, you may have luck with uploading this configuration file to the server

php_flag display_errors on php_flag display_startup_errors on php_value error_reporting 2047</nav>

  • Add another line of code to change the default PHP version setting for the amfphp directory:

<nav>#If you're working with a server which doesn't seem to display errors and you don't

  1. have access to httpd.conf and you have a good reason to develop remotely instead of
  2. locally, you may have luck with uploading this configuration file to the server

php_flag display_errors on php_flag display_startup_errors on php_value error_reporting 2047

SetEnv DEFAULT_PHP_VERSION 5</nav>