FirebirdSQL / php-firebird

Firebird PHP driver
Other
66 stars 15 forks source link

Error compiling the driver for php 8.3 #55

Open buhlerax opened 5 months ago

buhlerax commented 5 months ago

Environment: Debian 12 PHP 8.3 Firebird 5.0 PHPize and ./configure work normally. In make it gives this error:

root@alexandre:/opt/configuracoes/firebirdphp/php-firebird-master# make /bin/bash /opt/configuracoes/firebirdphp/php-firebird-master/libtool --mode=compile cc -I. -I/opt/configuracoes/firebirdphp/php-firebird-master -I/opt/configuracoes/firebirdphp/php-firebird-master/include -I/opt/configuracoes/firebirdphp/php-firebird-master/main -I/opt/configuracoes/firebirdphp/php-firebird-master -I/usr/include/php/20230831 -I/usr/include/php/20230831/main -I/usr/include/php/20230831/TSRM -I/usr/include/php/20230831/Zend -I/usr/include/php/20230831/ext -I/usr/include/php/20230831/ext/date/lib -I/opt/firebird/include -I/usr/include/firebird -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /opt/configuracoes/firebirdphp/php-firebird-master/interbase.c -o interbase.lo -MMD -MF interbase.dep -MT interbase.lo libtool: compile: cc -I. -I/opt/configuracoes/firebirdphp/php-firebird-master -I/opt/configuracoes/firebirdphp/php-firebird-master/include -I/opt/configuracoes/firebirdphp/php-firebird-master/main -I/opt/configuracoes/firebirdphp/php-firebird-master -I/usr/include/php/20230831 -I/usr/include/php/20230831/main -I/usr/include/php/20230831/TSRM -I/usr/include/php/20230831/Zend -I/usr/include/php/20230831/ext -I/usr/include/php/20230831/ext/date/lib -I/opt/firebird/include -I/usr/include/firebird -DHAVE_CONFIG_H -g -O2 -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DZEND_COMPILE_DL_EXT=1 -c /opt/configuracoes/firebirdphp/php-firebird-master/interbase.c -MMD -MF interbase.dep -MT interbase.lo -fPIC -DPIC -o .libs/interbase.o /opt/configuracoes/firebirdphp/php-firebird-master/interbase.c:30: warning: "_GNU_SOURCE" redefined 30 #define _GNU_SOURCE
: note: this is the location of the previous definition In file included from /opt/firebird/include/ibase.h:1200, from /opt/configuracoes/firebirdphp/php-firebird-master/php_ibase_includes.h:29, from /opt/configuracoes/firebirdphp/php-firebird-master/interbase.c:40: /opt/firebird/include/./iberror.h:93:10: fatal error: firebird/impl/iberror_c.h: No such file or directory 93 | #include "firebird/impl/iberror_c.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:210: interbase.lo] Erro 1
MartinKoeditz commented 5 months ago

Hi,

I will try to build the driver this weekend.

MartinKoeditz commented 5 months ago

Added the driver for PHP 8.3 to the releases section. Successfully tested with Firebird 5.0. Please give it a try.

buhlerax commented 4 months ago

I downloaded the latest driver change from github and tried to compile it. The same error appears. This file doesn't seem to be part of the firebird installation. /opt/firebird/include/./iberror.h:93:10: fatal error: firebird/impl/iberror_c.h: No such file or directory

It seems that the file exists on Windows but not on Linux

Thanks for your work for the community

stavikpetr commented 4 months ago

Added the driver for PHP 8.3 to the releases section. Successfully tested with Firebird 5.0. Please give it a try.

Could you please add dll for windows aswell? Thank you 🙏

buhlerax commented 4 months ago

Martin, Good morning, The module you compiled worked. But I want to know how to compile without that error.

image

buhlerax commented 3 months ago

Good morning, Can you please compile the dll in php 8.3 for windows? Thanks

mlazdans commented 2 months ago

You can get Windows DLLs built against v3.0.1 here: https://github.com/mlazdans/php-firebird/releases/tag/v3.0.1

buhlerax commented 2 months ago

Good morning I want to know how to compile without this error in Debian 12? I used manual installation of Firebird 5.0 Thanks

buhlerax commented 2 months ago

I copied the missing file (iberror_c.h) from the manual Firebird 5.0 installer to /opt/firebird/include/firebird/impl. After this I managed to compile. Thanks

caiofelipedossantos commented 3 weeks ago

Segue um passo-a-passo para ajudar na instalação do Interbase PDO para PHP no Ubuntu 22.04 LTE, especialmente para quem está enfrentando problemas:

1. Instalar as dependências Abra o terminal e execute o seguinte comando:

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https

2. Adicionar o repositório do PHP Digite o seguinte comando para adicionar o repositório:

LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php

3. Atualizar os pacotes Atualize a lista de pacotes disponíveis com o comando:

sudo apt update

4. Instalar o módulo do Interbase para a versão específica do PHP

Escolha a versão do PHP entre 5.6 e 8.3 e instale o módulo Interbase com o seguinte comando:

sudo apt-get install php{versao}-interbase

Substitua {versao} pela versão específica do PHP desejada, por exemplo, para PHP 7.4, use php7.4.

5. Verificar a instalação Após a instalação, você pode verificar se o módulo do Interbase foi instalado corretamente executando o seguinte comando:

php -m | grep interbase

Se o módulo estiver instalado corretamente, você verá uma saída indicando a presença do módulo Interbase.

Se precisar de mais alguma coisa, estou à disposição!

Procedimento testado com as seguintes versões do PHP 7.4, 8.1 e 8.2, os testes foram utilizando o PDO com PHP puro e testado tambem com o Laravel 8 e Laravel 10.

Não houve a necessidade de copilar os arquivos, visto que o repositório ondrej já possui eles copilados.

caiofelipedossantos commented 3 weeks ago

Here's a step-by-step guide to help with installing Interbase PDO for PHP on Ubuntu 22.04 LTE, especially for those facing issues:

1. Install Dependencies Open the terminal and execute the following command:

sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https

2. Add PHP Repository Enter the following command to add the repository:

LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php

3. Update Packages Update the list of available packages with the command:

sudo apt update

4. Install Interbase Module for Specific PHP Version

Choose the PHP version between 5.6 and 8.3 and install the Interbase module with the following command:

sudo apt-get install php{version}-interbase

Replace {version} with the specific PHP version desired, for example, for PHP 7.4, use php7.4.

5. Verify Installation After installation, you can verify if the Interbase module was installed correctly by executing the following command:

php -m | grep interbase

If the module is installed correctly, you'll see output indicating the presence of the Interbase module.

If you need anything else, feel free to ask!

Procedure tested with the following PHP versions 7.4, 8.1, and 8.2, tests were conducted using PDO with plain PHP and also tested with Laravel 8 and Laravel 10.

There was no need to compile files, as the ondrej repository already has them compiled.

buhlerax commented 3 weeks ago

You understand that with the Ondrej compilation, the Firebird library used will be the one that is installed on the distro and not necessarily the same one that you have on your distro.

I believe that this can cause problems.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Você entende que com a compilação do Ondrej a biliboteca usada do Firebird será a que ele tem instalado na distro e não necessariamente a mesma que você tem na sua distro.

Creio que isso pode gerar problemas.

caiofelipedossantos commented 3 weeks ago

Entendo sua preocupação, mas o uso do repositório do Ondrej pode ser uma solução prática e segura para a instalação. Passei algumas horas tentando resolver o mesmo problema que o seu, sem sucesso, especialmente quando se trata de versões mais recentes ou específicas que não estão disponíveis nos repositórios padrão da distribuição.

Ao utilizar o repositório do Ondrej para instalar a biblioteca Firebird, você está, de fato, dependendo da versão da biblioteca disponibilizada por esse repositório. No entanto, ao utilizá-la e fazer testes, consegui resolver meu problema de forma rápida. Por isso, destaquei no comentário que o processo foi realizado no Ubuntu versão 22.04 LTS.

Lembrando que, mesmo compilando e instalando o PHP, ele reconheceu o Interbase. No entanto, ao utilizar o PDO, houve um erro, sendo necessário recompilar e habilitar o PDO. O processo manual funciona, mas como precisei resolver o problema de forma rápida, optei pelo repositório do Ondrej.

===============================================================

I understand your concern, but using the Ondrej repository can be a practical and safe solution for installation. I spent several hours trying to solve the same problem as yours without success, especially when it comes to more recent or specific versions that are not available in the distribution's standard repositories.

By using the Ondrej repository to install the Firebird library, you are indeed relying on the version of the library provided by this repository. However, by using it and conducting tests, I was able to solve my problem quickly. That is why I emphasized in the comment that the process was carried out on Ubuntu version 22.04 LTS.

Remember that even after compiling and installing PHP, it recognized Interbase. However, when using PDO, it showed an error, requiring recompilation and enabling PDO. The manual process works, but since I needed to solve the problem quickly, I chose to use the Ondrej repository.