Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Installing Oracle for PHP: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
(Adding additional setup instructions)
(Shifting PHP instructions to earlier section)
Línia 36: Línia 36:
Note: Oracle Express Edition 10g is limited at one database called 'XE'.
Note: Oracle Express Edition 10g is limited at one database called 'XE'.


=== Set up your oracle extension ===
=== Set up your Oracle extension ===
This document does not explain how to setup apache/php for Oracle. You can have more information on [http://www.oracle.com/technology/tech/php/htdocs/php-oracle-tutorial.html Oracle Documentation]. On my own machine I used my WAMP installation ([http://www.en.wampserver.com/ Wampserver 2.0]) which allowed me to activate all oracle extensions in few clicks (php_oci8, php_oracle, php_pdo_oci, php_pdo_oci8).
 
This document does not explain how to setup apache/php for Oracle. You can have more information on [http://www.oracle.com/technology/tech/php/htdocs/php-oracle-tutorial.html Oracle Documentation].
 
Edit your phi.ini file, uncomment the following line (remove the leading semicolon) and set the value to zero.
 
<code>
oci8.statement_cache_size = 0
</code>
 
Uncomment the php_oci8 extension. In a WAMP setup, this is listed as...
 
<code>
extension=php_oci8.dll
</code>
 
You may also need to uncomment php_oracle, php_pdo_oci, php_pdo_oci8 in some set-ups.


=== Install Moodle ===
=== Install Moodle ===
Línia 48: Línia 63:


=== Configure Apache ===
=== Configure Apache ===
Edit your phi.ini file, uncomment the following line (remove the leading semicolon) and set the value to zero.
<code>
oci8.statement_cache_size = 0
</code>


If you're running Moodle on Oracle with Apache on Linux, you might have issues with PHP being able to see the system environment variables.  To resolve this, you can edit /etc/sysconfig/apache2 and add the following lines to the bottom:<br />
If you're running Moodle on Oracle with Apache on Linux, you might have issues with PHP being able to see the system environment variables.  To resolve this, you can edit /etc/sysconfig/apache2 and add the following lines to the bottom:<br />

Revisió del 03:23, 12 abr 2012


Broken versions of OCI8 driver

PHP v5.2.4 (and perhaps v5.2.3 as well) have shipped with a bug in the OCI8 driver that leaks statement handles. The version of the OCI8 driver with the bug is v1.2.4. Possible workarounds:

  • Upgrade to PHP v5.2.5 or later
  • Downgrade to PHP v5.2.1 (reported to work)
  • Downgrade only the oci8 driver to the one included in PHP 5.2.1 (it worked for us -- iarenaza)
  • If you are on linux and/or can compile PECL extensions, install an older OCI8 driver (v1.2.3 seems to work) from the PECL repository http://pecl.php.net/package/oci8

More information at

Installing Moodle on Windows with Oracle Express Edition

Introduction

This section explains how to install Moodle with Oracle Express Edition on Windows. I'm using it for debugging purpose. It's definitively not a production environment. The goal is to setup easily and quickly a Moodle/Windows/Oracle environment.

Install Oracle

  1. Download Oracle Express Edition on Oracle web site.
  2. You will also need the Instant client from here (free account sign up needed). Copy everything from the unzipped folder into apache/bin.
  3. Install both.
  4. Access to the oracle console at http://127.0.0.1:8080/apex (Login=SYS Password=the_one_you_entered_during_the_installation).
  5. Create a new user and give it all rights (including DBA).
  6. Go to the SQL Commands page and grant your new user the dmbs_lock permission...

grant execute on dbms_lock to XXXXX; ...where XXXXX is the username of your new user.

  1. Log out and log in as the new user.
  2. Run the script found in the Moodle codebase at /lib/dml/oci_native_moodle_package.sql. If you can not run this script directly, you can run its parts (separated by slashes) independently via the SQL Commands page.

Note: Oracle Express Edition 10g is limited at one database called 'XE'.

Set up your Oracle extension

This document does not explain how to setup apache/php for Oracle. You can have more information on Oracle Documentation.

Edit your phi.ini file, uncomment the following line (remove the leading semicolon) and set the value to zero.

oci8.statement_cache_size = 0

Uncomment the php_oci8 extension. In a WAMP setup, this is listed as...

extension=php_oci8.dll

You may also need to uncomment php_oracle, php_pdo_oci, php_pdo_oci8 in some set-ups.

Install Moodle

On the database setup page:
Driver: Oracle oci8 (in the config file it should read "oci8po" for a 1.9.x install and "oci" for a 2.0.x install)
Host: empty the field
Database: //localhost:1521/XE
User: the user that you created
Password: the password you gave to the user

Configure Apache

If you're running Moodle on Oracle with Apache on Linux, you might have issues with PHP being able to see the system environment variables. To resolve this, you can edit /etc/sysconfig/apache2 and add the following lines to the bottom:

LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2# Set LANG Variables for UTF-8
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
NLS_NUMERIC_CHARACTERS='.,'

export LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIM NLS_LANG LD_LIBRARY_PATH NLS_NUMERIC_CHARACTERS

Also need to add those two lines to ~/.bashrc so that the PHP command-line client can see it too.

Related links