63 lines
2.4 KiB
Markdown
63 lines
2.4 KiB
Markdown
|
---
|
|||
|
tags:
|
|||
|
- php
|
|||
|
- oci8
|
|||
|
- oracle
|
|||
|
---
|
|||
|
|
|||
|
1. Ставим #OracleInstantClient вручную
|
|||
|
|
|||
|
2. Устанавливаем необходимые библиотеки для #php:
|
|||
|
|
|||
|
```shell
|
|||
|
sudo apt install php-dev php-pear build-essential libaio1 -y
|
|||
|
```
|
|||
|
|
|||
|
3. Обновляем каналы для #PECL:
|
|||
|
|
|||
|
```shell
|
|||
|
sudo pecl channel-update pecl.php.net
|
|||
|
```
|
|||
|
|
|||
|
4. Ставим #oci8:
|
|||
|
|
|||
|
```shell
|
|||
|
sudo pecl install oci8
|
|||
|
```
|
|||
|
|
|||
|
4.1. Если у вас больше одной версии php на машине, то можно указать конкретную версию (подробности [тут](https://stackoverflow.com/questions/40419718/how-to-install-php-extension-using-pecl-for-specific-php-version-when-several-p)):
|
|||
|
|
|||
|
```shell
|
|||
|
sudo pecl -d php_suffix=7.3 install -f oci8
|
|||
|
```
|
|||
|
|
|||
|
4.2. Когда pecl попросит ввести путь к клиенту оракл, вводим нечто похожее:
|
|||
|
|
|||
|
```
|
|||
|
instantclient,/opt/oci
|
|||
|
```
|
|||
|
|
|||
|
5. Включаем расширение oci8 для php:
|
|||
|
|
|||
|
```shell
|
|||
|
sudo sh -c "echo '; priority=10' > /etc/php/7.3/mods-available/oci8.ini"
|
|||
|
sudo sh -c "echo 'extension=oci8.so' >> /etc/php/7.3/mods-available/oci8.ini"
|
|||
|
sudo chmod 644 /etc/php/7.3/mods-available/oci8.ini
|
|||
|
sudo phpenmod -v php7.3 -s ALL oci8
|
|||
|
```
|
|||
|
|
|||
|
6. Проверяем работает ли расширение:
|
|||
|
|
|||
|
```shell
|
|||
|
php -m | grep oci8
|
|||
|
```
|
|||
|
|
|||
|
> [!seealso]
|
|||
|
> * [https://gist.github.com/milo/d4a15d67e6538bf82438babc39482b80](https://gist.github.com/milo/d4a15d67e6538bf82438babc39482b80)
|
|||
|
> * [https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e](https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e)
|
|||
|
> * [https://handynotes.ru/2007/05/linux-2.html](https://handynotes.ru/2007/05/linux-2.html)
|
|||
|
> * [http://aleksandr.ru/blog/oracle_client_vmeste_s_php_fpm/](http://aleksandr.ru/blog/oracle_client_vmeste_s_php_fpm/)
|
|||
|
> * [https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/](https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/)
|
|||
|
> * [https://serverfault.com/questions/589877/pecl-command-produces-long-list-of-errors](https://serverfault.com/questions/589877/pecl-command-produces-long-list-of-errors)
|
|||
|
> * [https://stackoverflow.com/questions/40419718/how-to-install-php-extension-using-pecl-for-specific-php-version-when-several-p](https://stackoverflow.com/questions/40419718/how-to-install-php-extension-using-pecl-for-specific-php-version-when-several-p)
|