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: Difference between revisions

From MoodleDocs
Line 24: Line 24:
* Download the latest version of [http://sourceforge.net/projects/amfphp/ AMFPHP], currently version 1.9.beta (SourceForge repository).
* Download the latest version of [http://sourceforge.net/projects/amfphp/ AMFPHP], currently version 1.9.beta (SourceForge repository).
* Unzip the file and find the directory amfphp.
* Unzip the file and find the directory amfphp.
* Upload the amfphp directory to http://***MOODLEROOT***/lib/
* Upload the amfphp directory to ***MOODLEROOT***/lib/
* That's it!
* 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:
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 ***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:


* Find the AMFPHP .htaccess file at http://***MOODLEROOT***/lib/amfphp/.htaccess
* Find the AMFPHP .htaccess file at ***MOODLEROOT***/lib/amfphp/.htaccess
* Open it with a text editor. You'll see:
* Open it with a text editor. You'll see:
<pre>#If you're working with a server which doesn't seem to display errors and you don't  
<pre>#If you're working with a server which doesn't seem to display errors and you don't  

Revision as of 10:27, 9 October 2008

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 ***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 ***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:

  • Find the AMFPHP .htaccess file at ***MOODLEROOT***/lib/amfphp/.htaccess
  • Open it with a text editor. You'll see:
#If you're working with a server which doesn't seem to display errors and you don't 
#have access to httpd.conf and you have a good reason to develop remotely instead of
#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
  • Add another line of code to change the default PHP version setting for the amfphp directory:
#If you're working with a server which doesn't seem to display errors and you don't 
#have access to httpd.conf and you have a good reason to develop remotely instead of
#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