Skip to content

Commit aafe141

Browse files
authored
Merge branch 'FirebirdSQL:master' into master
2 parents 38c3e0e + c959595 commit aafe141

14 files changed

Lines changed: 174 additions & 2 deletions

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# PHP Firebird extension
22

3+
## Using the driver on Windows
4+
In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows" (https://www.php.net/manual/en/faq.installation.php#faq.installation.addtopath). Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: fbclient.dll,gds32.dll
5+
6+
If you installed the Firebird/InterBase database server on the same machine PHP is running on, you will have this DLL already and fbclient.dll, gds32.dll (gds32.dll is generated from the installer for legacy applications) will already be in the PATH.
7+
38
## Building the driver
49

510
### Build the driver on Linux
File renamed without changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
# Configuration
4+
FIREBIRD_INCLUDE_DIR="/opt/firebird/include"
5+
INSTALL_DIR="../ext"
6+
REPO_URL="https://github.com/FirebirdSQL/php-firebird.git"
7+
DRIVER_VERSION="5.0.2"
8+
BRANCH_OR_COMMIT="master" # Set to a specific tag or commit if needed
9+
PHP_VERSIONS=("7.4" "8.0" "8.1" "8.2" "8.3" "8.4") # Adjust as needed
10+
BUILD_DIR="php-firebird-build"
11+
12+
set -e
13+
14+
mkdir -p "$INSTALL_DIR"
15+
rm -rf "$BUILD_DIR"
16+
echo "Cloning repository from $REPO_URL (branch: $BRANCH_OR_COMMIT)..."
17+
git clone --depth 1 --branch "$BRANCH_OR_COMMIT" "$REPO_URL" "$BUILD_DIR"
18+
19+
for VERSION in "${PHP_VERSIONS[@]}"; do
20+
echo "==> Building for PHP $VERSION"
21+
22+
PHP_BIN="/usr/bin/php$VERSION"
23+
PHPIZE="/usr/bin/phpize$VERSION"
24+
PHP_CONFIG="/usr/bin/php-config$VERSION"
25+
26+
if [[ ! -x "$PHP_BIN" || ! -x "$PHPIZE" || ! -x "$PHP_CONFIG" ]]; then
27+
echo "--> Installing missing PHP $VERSION packages..."
28+
sudo apt-get install -y "php$VERSION-dev" "php$VERSION-cli" "php$VERSION-common"
29+
fi
30+
31+
cd "$BUILD_DIR"
32+
33+
echo "--> Cleaning previous build (if any)..."
34+
make clean || true
35+
echo "--> Running phpize..."
36+
"$PHPIZE"
37+
echo "--> Configuring build..."
38+
CPPFLAGS="-I$FIREBIRD_INCLUDE_DIR" ./configure --with-php-config="$PHP_CONFIG"
39+
echo "--> Compiling..."
40+
make -j"$(nproc)"
41+
42+
PHP_FULL_VERSION=$("$PHP_BIN" -r 'echo PHP_VERSION;')
43+
ARCH=$(uname -m)
44+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
45+
46+
OUTPUT_FILE="php_${PHP_FULL_VERSION}-interbase-${DRIVER_VERSION}-${OS}-${ARCH}.so"
47+
mkdir -p "$INSTALL_DIR"
48+
echo "--> Copying output to $INSTALL_DIR/$OUTPUT_FILE"
49+
cp modules/interbase.so "$INSTALL_DIR/$OUTPUT_FILE"
50+
51+
echo "Build complete for PHP $VERSION: $OUTPUT_FILE"
52+
cd ..
53+
done
54+
55+
echo "All builds completed. Files are located in: $INSTALL_DIR"
56+

ibase_query.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,10 @@ static void _php_ibase_alloc_xsqlda(XSQLDA *sqlda) /* {{{ */
947947
for (i = 0; i < sqlda->sqld; i++) {
948948
XSQLVAR *var = &sqlda->sqlvar[i];
949949

950+
if ((var->sqltype & ~1) == SQL_TEXT) {
951+
var->sqltype = SQL_VARYING | (var->sqltype & 1);
952+
}
953+
950954
switch (var->sqltype & ~1) {
951955
case SQL_TEXT:
952956
var->sqldata = safe_emalloc(sizeof(char), var->sqllen, 0);

interbase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "php_interbase.h"
4343
#include "php_ibase_includes.h"
4444
#include "SAPI.h"
45-
45+
#include <stdbool.h>
4646
#include <time.h>
4747

4848
#define ROLLBACK 0

0 commit comments

Comments
 (0)