oci_server_version
(PHP 5, PECL OCI8 >= 1.1.0)
oci_server_version — Returns the Oracle Database version
Description
string oci_server_version
( resource
$connection
)Returns a string with the Oracle Database version and available options
Parameters
-
connection
-
Return Values
Returns the version information as a string or FALSE
on error.
Examples
Example #1 oci_server_version() example
<?php
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
echo "Server Version: " . oci_server_version($conn);
// Displays:
// Server Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
// With the Partitioning, OLAP, Data Mining and Real Application Testing option
oci_close($conn);
?>
Notes
Note:
In PHP versions before 5.0.0 you must use ociserverversion() instead. This old name still can be used. However it is deprecated and not recommended.
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- Oracle OCI8
- oci_bind_array_by_name
- oci_bind_by_name
- oci_cancel
- oci_client_version
- oci_close
- oci_commit
- oci_connect
- oci_define_by_name
- oci_error
- oci_execute
- oci_fetch_all
- oci_fetch_array
- oci_fetch_assoc
- oci_fetch_object
- oci_fetch_row
- oci_fetch
- oci_field_is_null
- oci_field_name
- oci_field_precision
- oci_field_scale
- oci_field_size
- oci_field_type_raw
- oci_field_type
- oci_free_descriptor
- oci_free_statement
- oci_get_implicit_resultset
- oci_internal_debug
- oci_lob_copy
- oci_lob_is_equal
- oci_new_collection
- oci_new_connect
- oci_new_cursor
- oci_new_descriptor
- oci_num_fields
- oci_num_rows
- oci_parse
- oci_password_change
- oci_pconnect
- oci_result
- oci_rollback
- oci_server_version
- oci_set_action
- oci_set_client_identifier
- oci_set_client_info
- oci_set_edition
- oci_set_module_name
- oci_set_prefetch
- oci_statement_type
Коментарии
Here's now to extract just the major.minor version number:
<?php
$link = oci_new_connect($username, $password, $server, "AL32UTF8");
$server_info = oci_server_version($link);
$version = preg_replace('~^.* (\d+\.\d+)\.\d+\.\d+\.\d+.*~s', '\1', $server_info);
echo "$server_info<br>";
// Oracle Database 11g Release 11.2.0.4.0 - 64bit Production
echo "$version<br>";
// 11.2
?>
And here's how to look up version via SQL:
https://www.oracle.com/pls/topic/lookup?ctx=db122&id=ADMIN11039
SELECT * FROM PRODUCT_COMPONENT_VERSION;
PRODUCT VERSION STATUS
---------------------------------------- ----------- -----------
NLSRTL 12.1.0.0.1 Production
Oracle Database 12c Enterprise Edition 12.1.0.0.1 Production
PL/SQL 12.1.0.0.1 Production
?>