<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Installing_Oracle_for_PHP</id>
	<title>Installing Oracle for PHP - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Installing_Oracle_for_PHP"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Installing_Oracle_for_PHP&amp;action=history"/>
	<updated>2026-05-06T18:44:03Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Installing_Oracle_for_PHP&amp;diff=183&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Installing_Oracle_for_PHP&amp;diff=183&amp;oldid=prev"/>
		<updated>2024-10-14T16:47:12Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 16:47, 14 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Installing_Oracle_for_PHP&amp;diff=182&amp;oldid=prev</id>
		<title>1&gt;Tim@horizoneducationnetwork.org: clean up, typos fixed:</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Installing_Oracle_for_PHP&amp;diff=182&amp;oldid=prev"/>
		<updated>2021-09-22T14:19:07Z</updated>

		<summary type="html">&lt;p&gt;clean up, typos fixed:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;* http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html&lt;br /&gt;
* http://moodle.org/mod/forum/discuss.php?d=65488#p308002 (with attached html document)&lt;br /&gt;
* http://es.php.net/oci8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installing Moodle on Windows with Oracle Express Edition ==&lt;br /&gt;
&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
This section explains how to install Moodle with Oracle Express Edition on Windows. I&amp;#039;m using it for &amp;#039;&amp;#039;&amp;#039;debugging&amp;#039;&amp;#039;&amp;#039; purpose. It&amp;#039;s definitively not a production environment. The goal is to setup easily and quickly a Moodle/Windows/Oracle environment.&lt;br /&gt;
&lt;br /&gt;
=== Install Oracle ===&lt;br /&gt;
# Download Oracle Express Edition on [http://www.oracle.com/technology/products/database/xe/index.html Oracle web site].&lt;br /&gt;
# You will also need the Instant client [http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html from here] (free account sign up needed). Copy everything from the unzipped folder into apache/bin.&lt;br /&gt;
# Install both.&lt;br /&gt;
# Access to the oracle console at http://127.0.0.1:8080/apex (Login=SYS Password=the_one_you_entered_during_the_installation).&lt;br /&gt;
# Create a new user and give it all rights (including DBA).&lt;br /&gt;
# Go to the SQL Commands page and grant your new user the dmbs_lock permission...&amp;lt;code sql&amp;gt;&lt;br /&gt;
grant execute on dbms_lock to XXXXX;&lt;br /&gt;
&amp;lt;/code&amp;gt;...where XXXXX is the username of your new user.&lt;br /&gt;
# Log out and log in as the new user.&lt;br /&gt;
# 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.&lt;br /&gt;
&lt;br /&gt;
Note: Oracle Express Edition 10g is limited at one database called &amp;#039;XE&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
=== Set up your Oracle extension ===&lt;br /&gt;
&lt;br /&gt;
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].&lt;br /&gt;
&lt;br /&gt;
Edit your phi.ini file, uncomment (remove the leading semicolon) the php_oci8 extension. In a WAMP setup, this is listed as...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
extension=php_oci8.dll&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, if you are going to use the installation for development/testing purposes, uncomment the following line and set the value to zero. It&amp;#039;s not needed for normal operations (it causes a BIG slowdown of the system!).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
oci8.statement_cache_size = 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You may also need to uncomment php_oracle, php_pdo_oci, php_pdo_oci8 in some set-ups.&lt;br /&gt;
&lt;br /&gt;
=== Install Moodle ===&lt;br /&gt;
On the database setup page:&amp;lt;br /&amp;gt;&lt;br /&gt;
Driver: Oracle oci8 (in the config file it should read &amp;quot;oci8po&amp;quot; for a 1.9.x install and &amp;quot;oci&amp;quot; for a 2.0.x install)&amp;lt;br /&amp;gt;&lt;br /&gt;
Host: empty the field&amp;lt;br /&amp;gt;&lt;br /&gt;
Database: //localhost:1521/XE&amp;lt;br /&amp;gt;&lt;br /&gt;
User: the user that you created&amp;lt;br /&amp;gt;&lt;br /&gt;
Password: the password you gave to the user&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure Apache ===&lt;br /&gt;
&lt;br /&gt;
If you&amp;#039;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:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
LD_LIBRARY_PATH=/opt/oracle/instantclient_11_2# Set LANG Variables for UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
NLS_LANG=AMERICAN_AMERICA.AL32UTF8&amp;lt;br /&amp;gt;&lt;br /&gt;
LANG=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_ALL=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_COLLATE=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_CTYPE=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_MESSAGES=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_MONETARY=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_NUMERIC=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
LC_TIME=en_US.UTF-8&amp;lt;br /&amp;gt;&lt;br /&gt;
NLS_NUMERIC_CHARACTERS=&amp;#039;.,&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
export LANG LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIM NLS_LANG LD_LIBRARY_PATH NLS_NUMERIC_CHARACTERS&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
Also need to add those two lines to ~/.bashrc so that the PHP command-line client can see it too. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing Oracle Express on Ubuntu ==&lt;br /&gt;
&lt;br /&gt;
I needed to test an installation of Oracle with Moodle, here&amp;#039;s what I did&lt;br /&gt;
&lt;br /&gt;
* Ubuntu 14.04.1 LTS 64 bit&lt;br /&gt;
* Oracle 11g Release 2 Express Edition&lt;br /&gt;
* SQL Developer 4.0.3.16&lt;br /&gt;
&lt;br /&gt;
=== Oracle Express and SQL Developer ===&lt;br /&gt;
&lt;br /&gt;
Ignore all other sites and follow these instructions - http://blog.whitehorses.nl/2014/03/18/installing-java-oracle-11g-r2-express-edition-and-sql-developer-on-ubuntu-64-bit/&lt;br /&gt;
&lt;br /&gt;
Log out of Chrome before doing this bit though because Chrome uses the same folder and it will instantly crash.&lt;br /&gt;
&lt;br /&gt;
 sudo rm -rf /dev/shm&lt;br /&gt;
 sudo mkdir /dev/shm&lt;br /&gt;
 sudo mount -t tmpfs shmfs -o size=4096m /dev/shm&lt;br /&gt;
&lt;br /&gt;
Also, change 4096m to whatever half your memory is.&lt;br /&gt;
&lt;br /&gt;
If you get a fatal error when running sqldeveloper then&lt;br /&gt;
&lt;br /&gt;
 gksudo gedit /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper&lt;br /&gt;
&lt;br /&gt;
and add these 2 lines at the top&lt;br /&gt;
&lt;br /&gt;
 unset GNOME_DESKTOP_SESSION_ID&lt;br /&gt;
 unset DBUS_SESSION_BUS_ADDRESS&lt;br /&gt;
&lt;br /&gt;
Found the answer here http://linuxsagas.digitaleagle.net/2014/01/28/fixing-sql-developer-4-0/&lt;br /&gt;
&lt;br /&gt;
After installing and when creating a connection, the default username is SYSTEM and use the password created in the step sudo /etc/init.d/oracle-xe configure&lt;br /&gt;
&lt;br /&gt;
In gnome classic - The menus for Oracle are under Other, sqldeveloper is under Programming&lt;br /&gt;
&lt;br /&gt;
=== Create a user ===&lt;br /&gt;
&lt;br /&gt;
Probably easiest to use the application express:&lt;br /&gt;
&lt;br /&gt;
* Go to &amp;quot;Get Started With Oracle Database 11g Express Edition&amp;quot; - either from the applications -&amp;gt; other menu (in gnome) or via the desktop icon that was created when installing.&lt;br /&gt;
* This will open a page in your browser.&lt;br /&gt;
* Login as SYSTEM&lt;br /&gt;
* Click on the application express tab&lt;br /&gt;
* Create a user and password&lt;br /&gt;
* Then go to SQL Developer (In Gnome classic - go to applications -&amp;gt; programming -&amp;gt; sqldeveloper) and create and open a connection using the newly created user&lt;br /&gt;
&lt;br /&gt;
=== PHP ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions - https://help.ubuntu.com/community/PHPOracle&lt;br /&gt;
&lt;br /&gt;
Add extension=oci8.so to both /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini otherwise the client php cron won&amp;#039;t work&lt;br /&gt;
&lt;br /&gt;
Restart apache2&lt;br /&gt;
&lt;br /&gt;
Then test with this&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
error_reporting( -1 );&lt;br /&gt;
ini_set( &amp;#039;display_errors&amp;#039;, 1 );&lt;br /&gt;
&lt;br /&gt;
$conn = oci_connect(&amp;#039;USERNAME&amp;#039;, &amp;#039;password&amp;#039;, &amp;#039;localhost/XE&amp;#039;);&lt;br /&gt;
if (!$conn) {&lt;br /&gt;
    $e = oci_error();&lt;br /&gt;
    trigger_error(htmlentities($e[&amp;#039;message&amp;#039;], ENT_QUOTES), E_USER_ERROR);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Prepare the statement&lt;br /&gt;
$sql = &amp;quot;SELECT * FROM atable&amp;quot;; // Change this.&lt;br /&gt;
$stid = oci_parse($conn, $sql);&lt;br /&gt;
if (!$stid) {&lt;br /&gt;
    $e = oci_error($conn);&lt;br /&gt;
    trigger_error(htmlentities($e[&amp;#039;message&amp;#039;], ENT_QUOTES), E_USER_ERROR);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Perform the logic of the query&lt;br /&gt;
$r = oci_execute($stid);&lt;br /&gt;
if (!$r) {&lt;br /&gt;
    $e = oci_error($stid);&lt;br /&gt;
    trigger_error(htmlentities($e[&amp;#039;message&amp;#039;], ENT_QUOTES), E_USER_ERROR);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Fetch the results of the query&lt;br /&gt;
print &amp;quot;&amp;lt;table border=&amp;#039;1&amp;#039;&amp;gt;\n&amp;quot;;&lt;br /&gt;
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {&lt;br /&gt;
    print &amp;quot;&amp;lt;tr&amp;gt;\n&amp;quot;;&lt;br /&gt;
    foreach ($row as $item) {&lt;br /&gt;
        print &amp;quot;    &amp;lt;td&amp;gt;&amp;quot; . ($item !== null ? htmlentities($item, ENT_QUOTES) : &amp;quot;&amp;amp;nbsp;&amp;quot;) . &amp;quot;&amp;lt;/td&amp;gt;\n&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    print &amp;quot;&amp;lt;/tr&amp;gt;\n&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
print &amp;quot;&amp;lt;/table&amp;gt;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
oci_free_statement($stid);&lt;br /&gt;
oci_close($conn);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related links ==&lt;br /&gt;
*[http://lewiscarr.co.uk/2009/01/installing-oracle-drivers-with-php/ Installing ORACLE drivers with PHP]&lt;br /&gt;
*[[Installing MSSQL for PHP]]&lt;br /&gt;
*[[PHP]]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=134729#p588963 Can i install Moodle with Oracle database]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=65488 Who uses Oracle]&lt;br /&gt;
*[https://docs.moodle.org/en/Step-by-step_Install_Guide_for_Solaris_10_with_Oracle_10 Step by step Install Guide for Solaris 10 with Oracle 10]&lt;br /&gt;
*[http://learningischange.com/2009/05/29/install-moodle-on-an-oracle-database-in-25-minutes-or-less/ Install Moodle on an Oracle Database (in 25 minutes or less)]. The related Using Moodle forum discussion is [http://moodle.org/mod/forum/discuss.php?d=124629 here].&lt;br /&gt;
*[http://www.mguhlin.org/2009/05/moodle-on-oracle-database.html Moodle on Oracle Database] discussion on Miguel Guhlin&amp;#039;s blog &lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:XMLDB]]&lt;br /&gt;
[[Category:DB]]&lt;br /&gt;
[[Category:SQL databases]]&lt;/div&gt;</summary>
		<author><name>1&gt;Tim@horizoneducationnetwork.org</name></author>
	</entry>
</feed>