Install firebird php linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

License

FirebirdSQL/php-firebird

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Build the driver on Linux

First of all, we have to meet some requirements. This means we need to install the phpize command. The phpize command is used to prepare the build environment for a PHP extension. Install the phpize command. This is usually done by installing the php7-devel or php8-devel package using the system’s package manager. Also install the fbclient library and developer packages.

For OpenSuse 15.1 and PHP 7 use

$ zypper in php7-devel libfbclient2 libfbclient-devel 

The command in Linux Mint 20 / Ubuntu is

sudo apt-get install php-dev firebird-dev firebird3.0 firebird3.0-common firebird3.0-server 

Now make sure you provide the fbclient.so and the header files (ibase.h). These are needed to compile. You can specify the include path for the ibase.h file with CPPFLAGS as you can see in the following listing.

$ git clone https://github.com/FirebirdSQL/php-firebird.git $ cd php-firebird $ phpize $ CPPFLAGS=-I/usr/include/firebird ./configure $ make 

Note: If you use different PHP versions in parallel don’t forget to make the correct settings. Linux Mint 20 / Ubuntu uses this syntax:

$ git clone https://github.com/FirebirdSQL/php-firebird.git $ cd php-firebird $ phpize7.4 $ CPPFLAGS=-I/usr/include/firebird ./configure --with-php-config=/usr/bin/php-config7.4 $ make 

If the configure process passes you will get following message:

$ Build complete. $ Don't forget to run 'make test'. 

You can find the interbase.so file in directory php-firebird/modules . Copy the file to your php extension dir and restart your webserver.

Читайте также:  Updating grub in linux mint

Clean up your working directory

After you’ve created the binary data, many temporary files will be created in your working directory. These can be removed with the command phpize —clean . Then you have a tidy directory again.

Build the driver on Windows

First of all, we have to meet some requirements. This means we need to install the Git for Windows and Visual Studio 2017 with following components: Visual C++ 2017 (vc15) or Visual C++ 2019 (vs16) must be installed prior SDK usage. Required components

Also make sure you are using a 64-bit build host with Windows 7 or later. Of course we need some Firebird related stuff. The easiest way is to install the related Firebird version on your build host including the development files.

To start the build process open a command line. We assume that the build is done in the directory c:\php-sdk . So make sure you have the permission to create that folder on Drive C:.

git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk cd c:\php-sdk git checkout php-sdk-2.2.0 

With the above we downloaded the PHP SDK and entered our working directory.

Next we will prepare our build environment. For Win32 do:

Use following command for Win64:

If you use VS 2019, replace vc15 by vs16.

Now let’s create the build structure, download the PHP sources and checkout the desired development branch:

phpsdk_buildtree phpmaster git clone https://github.com/php/php-src.git && cd php-src && git checkout PHP-7.4.0 

Since we have our PHP sources now, we’re on to get the depending libraries.

phpsdk_deps --update --branch 7.4 

In the next step we will download our Firebird extension sources.

mkdir ..\pecl git clone https://github.com/FirebirdSQL/php-firebird.git ..\pecl\interbase 

If everything is ok, we can now compile our PHP extension. Please specify the the correct path to your Firebird installation.

Читайте также:  Linux on google servers

Usually you will build thread safe extensions. For Win32 thread safe (TS) do:

buildconf --force && configure --disable-all --enable-cli --with-interbase="shared,C:\Program Files (x86)\Firebird\3_0" && nmake 

For Win64thread safe (TS) do:

buildconf --force && configure --disable-all --enable-cli --with-interbase="shared,C:\Program Files\Firebird\3_0\lib" && nmake 

After the compilation you can find your extension called php_interbase.dll e.g. in C:\php-sdk\phpmaster\vc15\x64\php-src\x64\Release_TS\php_interbase.dll Replace x64 with x86 for Win32.

For Win32 non-thread safe (NTS) run:

buildconf --force && configure --disable-zts --disable-all --enable-cli --with-interbase="shared,C:\Program Files (x86)\Firebird\3_0" && nmake 

For Win64 non-thread safe (NTS) run:

buildconf --force && configure --disable-zts --disable-all --enable-cli --with-interbase="shared,C:\Program Files\Firebird\3_0\lib" && nmake 

After the compilation you can find your extension called php_interbase.dll e.g. in C:\php-sdk\phpmaster\vc15\x86\php-src\Release Replace x86 with x64 for Win64.

Clean up your working directory

After you’ve created the binary data, many temporary files will be created in your working directory. These can be removed with the command nmake clean . Then you have a tidy directory again.

Источник

Работа с Firebird в PHP через PDO

Обновлено и опубликовано

Опубликовано: 27.06.2021

Начиная с версии PHP 7.3 мы не можем использовать функции по работе с Firebird, так как они были исключены. Таким образом, можно работать с СУБД только через PDO. В данной инструкции мы рассмотрим процесс установки расширения PHP, а также примеры подключения к базе и выполнения SQL-запросов. Работа будет выполнена на примере Linux Ubuntu.

Установка расширения

Готово. Однако, если у нас несколько альтернативных версий PHP, установка должна выполняться с указанием конкретной версии, например:

Подключение к базе

  1. $dsn = ‘firebird:dbname=firebird.dmosk.ru:mydbname;charset=utf8;’;
  2. $username = ‘SYSDBA’;
  3. $password = ‘masterkey’;
  4. try
  5. $fire_conn = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
  6. > catch (PDOException $e)
  7. echo $e->getMessage();
  8. >
  • firebird:dbname=firebird.dmosk.ru:mydbname;charset=utf8 — строка подключения:
    • firebird — указание на драйвер, который должна использовать система.
    • dbname=firebird.dmosk.ru — сервер для подключения. Можно имя, а можно IP-адрес.
    • mydbname — имя базы данных, к которой мы будем подключаться.

    Выборка

    Для выполнения запроса SELECT применяем следующую конструкцию:

    1. $SQL = «SELECT * FROM users»;
    2. $result = $fire_conn->query($SQL);
    3. $result->setFetchMode(PDO::FETCH_ASSOC);
    4. while ($mass = $result->fetch())
    5. print_r($mass);
    6. >
    • $SQL — переменная с нашим запросом.
    • PDO::FETCH_ASSOC — режим, при котором возвращается только ассоциативный массив.
    • $mass — переменная, в которой будут данные, извлеченные из базы.

    Редактирование данных

    Под редактирование подразумевается добавление, редактирование или удаление. Запросы для этого разные, но с точки зрения работы через PDO процессы схожи. Рассмотрим на примере вставки:

    Источник

    Install firebird php linux

    Firebird is used by approximately 1 million of software developers worldwide. High compatibility with industry standards on many fronts makes Firebird the obvious choice for developing interoperable applications for homogeneous and hybrid environments.

    Join Firebird!

    Join Firebird Foundation to support Firebird SQL development and receive multiple bonuses

    Follow Us

    Select your media preference

    Newsletter

    Subscribe to Firebird’s Newsletter to receive the latest news

    New project: downloads will be posted here as soon as they are available.
    For the latest development news, see the Development page for this driver.

    You can find current releases on Github.

    Following table shows only archived versions.

    Release Date File Name Size Description
    2020-08-13 php-7.4.3-interbase-1.1.0-beta-linux-x64.tar.gz (for PHP 7.4) 180Kb Linux x64
    (Beta boolean support)
    2020-08-13 php-7.4.0-interbase-1.1.0-beta-win64.zip (for PHP 7.4) 70Kb Windows x64
    (Beta boolean support)
    2020-08-13 php-7.4.0-interbase-1.1.0-beta-win32.zip (for PHP 7.4) 61Kb Windows x86
    (Beta boolean support)
    2020-08-17 php-7.3.21-interbase-1.1.0-beta-linux-x64.tar.gz (for PHP 7.3) 182Kb Linux x64
    (Beta boolean support)
    2020-08-13 php-7.3.0-interbase-1.1.0-beta-win64.zip (for PHP 7.3) 71Kb Windows x64
    (Beta boolean support)
    2020-08-13 php-7.3.0-interbase-1.1.0-beta-win32.zip (for PHP 7.3) 62Kb Windows x86
    (Beta boolean support)
    2019-12-01 php-7.4.0-interbase-linux-x64.gz (for PHP 7.4) 148Kb Linux
    2019-12-16 php-7.4.0-interbase-win32.zip (for PHP 7.4) 61Kb Windows x86
    2019-12-16 php-7.4.0-interbase-win64.zip (for PHP 7.4) 71Kb Windows x64
    2019-05-31 php-7.3.0-interbase-linux.tar.gz (for PHP 7.3) 123Kb Linux
    2019-05-16 php-7.3.0-interbase-win32.zip (for PHP 7.3) 61Kb Windows x86
    2019-05-16 php-7.3.0-interbase-win64.zip (for PHP 7.3) 70Kb Windows x64

    New project: downloads will be posted here as soon as they are available.
    For the latest development news, see the Development page for this driver.

    Источник

Оцените статью
Adblock
detector