1
0
Fork 0

Compare commits

...

23 commits

Author SHA1 Message Date
89fe566573
Update for PHP 8.4 and my needs (packaging happens elsewhere) 2025-10-13 10:45:01 +11:00
Anton Batenev
96df2f4362
Merge pull request #9 from sergeypayu/master
Added PHP7 compilation support
2017-12-26 19:52:13 +03:00
Sergey Payu
f880a67457 Removed excplicit using of VFS 2017-12-08 09:24:08 +00:00
Sergey Payu
bcec9ca73f Added PHP7 compilation support 2017-12-08 09:20:44 +00:00
Sergey Payu
5cb3be32c4 Merge remote-tracking branch 'upstream/master' 2017-12-08 09:18:54 +00:00
Anton Batenev
83409a8985 Merge pull request #7 from kynetiv/php5.6
Update config.m4 for PHP 5.6
2017-07-19 16:39:45 +03:00
Miles Fink
c9b5f62ec3 Update config.m4 for PHP 5.6 2017-07-19 09:34:57 -04:00
sergeypayu
3960a233c4 Updated sed command to change VFS 2017-03-01 13:05:26 +02:00
sergeypayu
964db221c5 Hardcoded change VFS type 2017-03-01 12:52:43 +02:00
Vincent Kersten
37b0e09c94 Add instructions for install 2017-02-28 17:00:39 +02:00
Anton Batenev
eb0ec7f9c2 Merge pull request #6 from vincentkersten/master
Make package based on debian source package
2015-06-04 00:46:21 +03:00
Vincent Kersten
d98007d317 Add instructions for install 2015-05-11 09:45:08 +02:00
Vincent Kersten
d06aabf179 fix up sed line 2015-05-11 09:41:51 +02:00
Vincent Kersten
57375aee9c set proper version for deb 2015-05-11 09:40:09 +02:00
Vincent Kersten
db089965b3 Make the source line proper 2015-05-11 09:30:38 +02:00
Vincent Kersten
238613b4c6 add qoute and proper replace order 2015-05-11 09:27:53 +02:00
Vincent Kersten
925d306a67 touchup control 2015-05-11 09:25:43 +02:00
Vincent Kersten
c8fb55c87f strip source line from version 2015-05-11 08:48:27 +02:00
Vincent Kersten
ae66aced1f add the all-in-one-go script for a debian package 2015-05-11 08:20:37 +02:00
Vincent Kersten
8e86d65b58 do replace in-file with sed 2015-05-11 08:17:24 +02:00
root
a53b3d7249 create control.in 2015-05-11 07:12:49 +02:00
Anton Batenev
f044b3401a Merge pull request #5 from Aldekein/patch-1
Update config.m4 for PHP 5.5 on AWS
2014-06-16 15:04:32 +04:00
Oleg Aldekein
a7b2518828 Update config.m4 for PHP 5.5 on AWS 2014-06-16 13:38:24 +03:00
11 changed files with 31 additions and 780 deletions

View file

@ -1,54 +0,0 @@
# PDO SQLCipher
A driver for implementing [PDO](http://php.net/manual/en/book.pdo.php) (PHP Data Objects) interface for [SQLCipher](http://sqlcipher.net) without replacing genuine PDO SQLite or the system version of [SQLite](http://www.sqlite.org/). It's based on PDO SQLite source code and created by simply replacing names and inserting SQLCipher code (instead of dynamic linking with SQLite libraries).
A detachment of this kind allows granting access to encrypted databases only to applications that obviously need it, without fear of data loss or slowing down other applications.
## Assembling
To assemble this extension, run `build.sh` script. After successful assembly, all the necessary files will be placed in the directory named `release`:
* `sqlcipher` - console client (equivalent of `sqlite3` client)
* `pdo_sqlcipher.so` - php extension (equivalent of `pdo_sqlite.so` extension)
If assembling is performed under Debain, the following dev packages may be required (in addition to standard):
* `libicu-dev`
* `libreadline-dev`
* `libssl-dev`
* `php5-dev`
* `tcl-dev`
If assembling is performed under RHEL, the following dev packages may be required (in addition to standard):
* `libicu-devel`
* `readline-devel`
* `openssl-devel`
* `php-devel`
* `tcl-devel`
If assembling is performed under FreeBSD, `lang/tcl-wrapper` port installation may be required (to support `tclsh`).
Assembling script was tested under Debian Wheezy (PHP 5.4.4-14) and FreeBSD 9.1 (PHP 5.4.13)
## Installation
Install this extension by copying files from the `release` directory:
* `sqlcipher` to the `/usr/local/bin/` directory
* `pdo_sqlcipher.so` to the directory of php modules (depends on specific distro):
* Debian: `/usr/lib/php5/20100525/`
* RHEL: `/usr/lib64/php/modules/`
* FreeBSD: `/usr/local/lib/php/20100525/`
And enable the php extension:
```
extension=pdo_sqlcipher.so
```
* Debian: `/etc/php5/conf.d/pdo_sqlcipher.ini`
* RHEL: `/etc/php.d/pdo_sqlcipher.ini`
* FreeBSD: `/usr/local/etc/php/extensions.ini`
You can find an example of extension usage in `example.php` file within the repository.

View file

@ -1,19 +1,17 @@
# PDO SQLCipher
[English version](https://github.com/abbat/pdo_sqlcipher/blob/master/README.en.md)
A driver for implementing [PDO](http://php.net/manual/en/book.pdo.php) (PHP Data Objects) interface for [SQLCipher](http://sqlcipher.net) without replacing genuine PDO SQLite or the system version of [SQLite](http://www.sqlite.org/). It's based on PDO SQLite source code and created by simply replacing names and inserting SQLCipher code (instead of dynamic linking with SQLite libraries).
Драйвер, реализующий интерфейс [PDO](http://php.net/manual/en/book.pdo.php) (PHP Data Objects) для [SQLCipher](http://sqlcipher.net) без замещения оригинальной версии PDO SQLite или системной версии [SQLite](http://www.sqlite.org/). Основан на оригинальном коде PDO SQLite путем простого замещения имен и встраиванием кода SQLCipher (вместо динамической линковки с библиотеками SQLite).
A detachment of this kind allows granting access to encrypted databases only to applications that obviously need it, without fear of data loss or slowing down other applications.
Подобное разделение позволяет работать с шифрованными базами только тем приложениям, которые в этом явно нуждаются не опасаясь потери данных или замедления работы остальных приложений.
## Assembling
## Сборка
To assemble this extension, run `build.sh` script. After successful assembly, all the necessary files will be placed in the directory named `release`:
Для сборки расширения запустите скрипт `build.sh`. После успешной сборки необходимые файлы будут помещены в директорию `release`:
* `sqlcipher` - console client (equivalent of `sqlite3` client)
* `pdo_sqlcipher.so` - php extension (equivalent of `pdo_sqlite.so` extension)
* `sqlcipher` - консольный клиент (аналогичный клиенту `sqlite3`)
* `pdo_sqlcipher.so` - расширение php (аналогичное расширению `pdo_sqlite.so`)
Для сборки под Debain могут потребоваться (помимо стандартных) следующие dev пакеты:
If assembling is performed under Debain, the following dev packages may be required (in addition to standard):
* `libicu-dev`
* `libreadline-dev`
@ -21,7 +19,7 @@
* `php5-dev`
* `tcl-dev`
Для сборки под RHEL могут потребоваться (помимо стандартных) следующие dev пакеты:
If assembling is performed under RHEL, the following dev packages may be required (in addition to standard):
* `libicu-devel`
* `readline-devel`
@ -29,21 +27,21 @@
* `php-devel`
* `tcl-devel`
Для сборки под FreeBSD может потребоваться установка порта `lang/tcl-wrapper` (для поддержки `tclsh`).
If assembling is performed under FreeBSD, `lang/tcl-wrapper` port installation may be required (to support `tclsh`).
Скрипт сборки протестирован на Debian Wheezy (PHP 5.4.4-14) и FreeBSD 9.1 (PHP 5.4.13)
Assembling script was tested under Debian Wheezy (PHP 5.4.4-14) and FreeBSD 9.1 (PHP 5.4.13)
## Установка
## Installation
Для установки расширения скопируйте файлы из директории `release`:
Install this extension by copying files from the `release` directory:
* `sqlcipher` в директорию `/usr/local/bin/`
* `pdo_sqlcipher.so` в директорию модулей php (зависит от дистрибутива):
* `sqlcipher` to the `/usr/local/bin/` directory
* `pdo_sqlcipher.so` to the directory of php modules (depends on specific distro):
* Debian: `/usr/lib/php5/20100525/`
* RHEL: `/usr/lib64/php/modules/`
* FreeBSD: `/usr/local/lib/php/20100525/`
И подключите расширение php:
And enable the php extension:
```
extension=pdo_sqlcipher.so
@ -53,4 +51,4 @@ extension=pdo_sqlcipher.so
* RHEL: `/etc/php.d/pdo_sqlcipher.ini`
* FreeBSD: `/usr/local/etc/php/extensions.ini`
Пример использования расширения можно найти в файле `example.php` репозитория.
You can find an example of extension usage in `example.php` file within the repository.

View file

@ -1,311 +0,0 @@
#!/bin/sh
#
# SQLite3 compile options
#
CFLAGS=" \
-DSQLITE_HAS_CODEC \
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_ENABLE_STAT3 \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_SECURE_DELETE \
-DSQLITE_ENABLE_ICU \
-DSQLITE_SOUNDEX \
-DSQLITE_DEFAULT_FOREIGN_KEYS=1 \
-I. -I/usr/local/include"
LDFLAGS="-lcrypto -licuuc -licui18n -L/usr/local/lib"
PHP_CONFIG=$(which php-config)
if [ "x${PHP_CONFIG}" = "x" ]; then
echo "Error: php-config not found"
exit 1
fi
PHP_VER=$(${PHP_CONFIG} --version )
PHP_API=$(${PHP_CONFIG} --phpapi )
# There is prolly a better way to do this (getting the proper source pkg name):
PHP_DEB_VER="$(dpkg-query -W -f='${Version}' php5)"
PHP_SRC=php5-${PHP_DEB_VER%*-*}
if [ "x${PHP_VER}" = "x" ]; then
echo "Error: unknown php version"
exit 1
fi
if [ ! -f "${PHP_SRC}" ]; then
apt-get source php5
if [ $? -ne 0 ]; then
# sources.list not defined source packages
echo "Cannot get the php source package, please add a 'source' line to /etc/apt/sources.list"
exit $?
fi
fi
#
# Get SQLCipher source code and make SQLite Amalgamation
#
SQLCIPHER_SRC="sqlcipher.git"
if [ ! -d "${SQLCIPHER_SRC}" ]; then
git clone "git://github.com/sqlcipher/sqlcipher.git" "${SQLCIPHER_SRC}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
if [ ! -f "${SQLCIPHER_SRC}/sqlite3.c" ]; then
cd "${SQLCIPHER_SRC}"
make distclean
# subject to change (see http://www.sqlite.org/compile.html)
./configure \
--disable-shared \
--enable-tempstore=yes \
CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}"
if [ $? -ne 0 ]; then
exit $?
fi
make
if [ $? -ne 0 ]; then
exit $?
fi
cd ..
fi
#
# Clone pdo_sqlite sources for pdo_sqlcipher
#
BUILD_DIR="build"
if [ -d "${BUILD_DIR}" ]; then
rm -rf "${BUILD_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
mkdir -p "${BUILD_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
PDO_SQLITE="${PHP_SRC}/ext/pdo_sqlite"
cp "${PDO_SQLITE}/"*.c "${PDO_SQLITE}"/*.h "${BUILD_DIR}/"
if [ $? -ne 0 ]; then
exit $?
fi
# magic :)
for FILE in "${BUILD_DIR}"/*
do
cat "${FILE}" | \
sed -e 's/sqlite/sqlcipher/g' | \
sed -e 's/SQLite/SQLCipher/g' | \
sed -e 's/PDO_SQLITE/PDO_SQLCIPHER/g' > \
"${FILE}.tmp"
if [ $? -ne 0 ]; then
exit $?
fi
NEW_FILE=$(echo ${FILE} | sed 's/sqlite/sqlcipher/')
mv "${FILE}.tmp" "${NEW_FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
if [ "${NEW_FILE}" != "${FILE}" ]; then
rm -f "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
done
# magic for sqlite3 api sources
cp "${SQLCIPHER_SRC}/sqlite3.c" "${BUILD_DIR}/sqlcipher3.c"
if [ $? -ne 0 ]; then
exit $?
fi
cp "${SQLCIPHER_SRC}/sqlite3.h" "${BUILD_DIR}/sqlcipher3.h"
if [ $? -ne 0 ]; then
exit $?
fi
for FILE in "${BUILD_DIR}"/sqlcipher3.*
do
sed -ie 's/sqlite3/sqlcipher3/g' "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
sed -rie 's/(".*)sqlcipher3(.*")/\1sqlite3\2/g' "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
done
#
# Build pdo_sqlcipher
#
cp "config.m4" "${BUILD_DIR}/config.m4"
if [ $? -ne 0 ]; then
exit $?
fi
cd "${BUILD_DIR}"
phpize --clean
if [ $? -ne 0 ]; then
exit $?
fi
phpize
if [ $? -ne 0 ]; then
exit $?
fi
./configure \
CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}"
if [ $? -ne 0 ]; then
exit $?
fi
make
if [ $? -ne 0 ]; then
exit $?
fi
cd ..
#
# Copy binaries
#
RELEASE_DIR="release"
if [ -d "${RELEASE_DIR}" ]; then
rm -rf "${RELEASE_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
mkdir -p "${RELEASE_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
# pdo_sqlite.so
cp "${BUILD_DIR}/modules/pdo_sqlcipher.so" "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
strip "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
chmod 0644 "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
# sqlcipher static binary
cp "${SQLCIPHER_SRC}/sqlcipher" "${RELEASE_DIR}/sqlcipher"
if [ $? -ne 0 ]; then
exit $?
fi
strip "${RELEASE_DIR}/sqlcipher"
if [ $? -ne 0 ]; then
exit $?
fi
#
# Clean
#
#rm -rf ${PHP_SRC}
#rm -rf ${SQLCIPHER_SRC}
#rm -rf ${BUILD_DIR}
#rm -f ${PHP_TGZ}
## Create the .deb package
LIBICU="$(dpkg-query -W -f='${Package}\n' libicu* | grep -v '\-')"
LIBICU_VER="$(dpkg-query -W -f='${Version}' $LIBICU)"
sed -i "s/_PHP_DEB_VER/$PHP_DEB_VER/g;s/_PHP_VER/$PHP_VER/g;s/_PHP_API/$PHP_API/g;s/_LIBICU_VER/$LIBICU_VER/g;s/_LIBICU/$LIBICU/g" package/DEBIAN/control
mkdir -p package/usr/bin
if [ $? -ne 0 ]; then
exit $?
fi
mkdir -p package/usr/lib/php5/${PHP_API}
if [ $? -ne 0 ]; then
exit $?
fi
cp "${RELEASE_DIR}/pdo_sqlcipher.so" package/usr/lib/php5/${PHP_API}/
if [ $? -ne 0 ]; then
exit $?
fi
cp "${RELEASE_DIR}/sqlcipher" package/usr/bin/
if [ $? -ne 0 ]; then
exit $?
fi
cd package
md5deep -rl etc usr > DEBIAN/md5sums
if [ $? -ne 0 ]; then
exit $?
fi
cd ..
fakeroot dpkg-deb -z9 -b package
if [ $? -ne 0 ]; then
exit $?
fi
mv package.deb php5-sqlcipher.deb
if [ $? -ne 0 ]; then
exit $?
fi
# http://lintian.debian.org/tags.html
lintian php5-sqlcipher.deb
if [ $? -ne 0 ]; then
exit $?
fi
# clean
rm -rf package/usr/bin
rm -rf package/usr/lib
rm -f package/DEBIAN/md5sums

269
build.sh
View file

@ -1,269 +0,0 @@
#!/bin/sh
#
# SQLite3 compile options
#
CFLAGS=" \
-DSQLITE_HAS_CODEC \
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_ENABLE_STAT3 \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
-DSQLITE_ENABLE_FTS4 \
-DSQLITE_SECURE_DELETE \
-DSQLITE_ENABLE_ICU \
-DSQLITE_SOUNDEX \
-DSQLITE_DEFAULT_FOREIGN_KEYS=1 \
-I. -I/usr/local/include"
LDFLAGS="-lcrypto -licuuc -licui18n -L/usr/local/lib"
# fix FreeBSD include
UNAME=$(uname)
if [ "x${UNAME}" = "xFreeBSD" ]; then
CFLAGS="${CFLAGS} -include /usr/include/sys/stat.h"
fi
#
# Get PHP source code (installed version)
#
PHP_CONFIG=$(which php-config)
if [ "x${PHP_CONFIG}" = "x" ]; then
echo "Error: php-config not found"
exit 1
fi
# 5.3.3-7+squeeze13
PHP_VER=$(${PHP_CONFIG} --version | cut -d '-' -f 1)
if [ "x${PHP_VER}" = "x" ]; then
echo "Error: unknown php version"
exit 1
fi
PHP_SRC="php-${PHP_VER}"
PHP_TGZ="${PHP_SRC}.tar.gz"
if [ ! -f "${PHP_TGZ}" ]; then
wget "http://museum.php.net/php5/${PHP_TGZ}"
if [ $? -ne 0 ]; then
# newest version?
wget -O "${PHP_TGZ}" "http://ru2.php.net/get/${PHP_TGZ}/from/this/mirror"
if [ $? -ne 0 ]; then
exit $?
fi
fi
fi
if [ ! -d "${PHP_SRC}" ]; then
tar -xf "${PHP_TGZ}" -C ./
if [ $? -ne 0 ]; then
exit $?
fi
fi
#
# Get SQLCipher source code and make SQLite Amalgamation
#
SQLCIPHER_SRC="sqlcipher.git"
if [ ! -d "${SQLCIPHER_SRC}" ]; then
git clone "git://github.com/sqlcipher/sqlcipher.git" "${SQLCIPHER_SRC}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
if [ ! -f "${SQLCIPHER_SRC}/sqlite3.c" ]; then
cd "${SQLCIPHER_SRC}"
make distclean
# subject to change (see http://www.sqlite.org/compile.html)
./configure \
--disable-shared \
--enable-tempstore=yes \
CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}"
if [ $? -ne 0 ]; then
exit $?
fi
make
if [ $? -ne 0 ]; then
exit $?
fi
cd ..
fi
#
# Clone pdo_sqlite sources for pdo_sqlcipher
#
BUILD_DIR="build"
if [ -d "${BUILD_DIR}" ]; then
rm -rf "${BUILD_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
mkdir -p "${BUILD_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
PDO_SQLITE="${PHP_SRC}/ext/pdo_sqlite"
cp "${PDO_SQLITE}/"*.c "${PDO_SQLITE}"/*.h "${BUILD_DIR}/"
if [ $? -ne 0 ]; then
exit $?
fi
# magic :)
for FILE in "${BUILD_DIR}"/*
do
cat "${FILE}" | \
sed -e 's/sqlite/sqlcipher/g' | \
sed -e 's/SQLite/SQLCipher/g' | \
sed -e 's/PDO_SQLITE/PDO_SQLCIPHER/g' > \
"${FILE}.tmp"
if [ $? -ne 0 ]; then
exit $?
fi
NEW_FILE=$(echo ${FILE} | sed 's/sqlite/sqlcipher/')
mv "${FILE}.tmp" "${NEW_FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
if [ "${NEW_FILE}" != "${FILE}" ]; then
rm -f "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
done
# magic for sqlite3 api sources
cp "${SQLCIPHER_SRC}/sqlite3.c" "${BUILD_DIR}/sqlcipher3.c"
if [ $? -ne 0 ]; then
exit $?
fi
cp "${SQLCIPHER_SRC}/sqlite3.h" "${BUILD_DIR}/sqlcipher3.h"
if [ $? -ne 0 ]; then
exit $?
fi
for FILE in "${BUILD_DIR}"/sqlcipher3.*
do
sed -ie 's/sqlite3/sqlcipher3/g' "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
sed -rie 's/(".*)sqlcipher3(.*")/\1sqlite3\2/g' "${FILE}"
if [ $? -ne 0 ]; then
exit $?
fi
done
#
# Build pdo_sqlcipher
#
cp "config.m4" "${BUILD_DIR}/config.m4"
if [ $? -ne 0 ]; then
exit $?
fi
cd "${BUILD_DIR}"
phpize --clean
if [ $? -ne 0 ]; then
exit $?
fi
phpize
if [ $? -ne 0 ]; then
exit $?
fi
./configure \
CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}"
if [ $? -ne 0 ]; then
exit $?
fi
make
if [ $? -ne 0 ]; then
exit $?
fi
cd ..
#
# Copy binaries
#
RELEASE_DIR="release"
if [ -d "${RELEASE_DIR}" ]; then
rm -rf "${RELEASE_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
fi
mkdir -p "${RELEASE_DIR}"
if [ $? -ne 0 ]; then
exit $?
fi
# pdo_sqlite.so
cp "${BUILD_DIR}/modules/pdo_sqlcipher.so" "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
strip "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
chmod 0644 "${RELEASE_DIR}/pdo_sqlcipher.so"
if [ $? -ne 0 ]; then
exit $?
fi
# sqlcipher static binary
cp "${SQLCIPHER_SRC}/sqlcipher" "${RELEASE_DIR}/sqlcipher"
if [ $? -ne 0 ]; then
exit $?
fi
strip "${RELEASE_DIR}/sqlcipher"
if [ $? -ne 0 ]; then
exit $?
fi
#
# Clean
#
rm -rf ${PHP_SRC}
rm -rf ${SQLCIPHER_SRC}
rm -rf ${BUILD_DIR}
rm -f ${PHP_TGZ}

View file

@ -1,38 +1,45 @@
dnl $Id$
dnl config.m4 for extension pdo_sqlcipher
dnl vim:et:sw=2:ts=2:
PHP_ARG_ENABLE(pdo_sqlcipher, whether to enable pdo_sqlcipher support,
[ --enable-pdo_sqlcipher Enable pdo_sqlcipher support])
if test "$PHP_PDO_SQLCIPHER" != "no"; then
if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
fi
AC_MSG_CHECKING([for PDO includes])
if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$abs_srcdir/ext
elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$abs_srcdir/ext
elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$phpincludedir/ext
elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$prefix/include/php/ext
elif test -f $prefix/include/php5/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$prefix/include/php5/ext
elif test -f $prefix/include/php/5.5/php/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$prefix/include/php/5.5/php/ext
elif test -f $prefix/include/php/5.6/php/ext/pdo/php_pdo_driver.h; then
pdo_inc_path=$prefix/include/php/5.6/php/ext
else
AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
fi
AC_MSG_RESULT($pdo_inc_path)
php_pdo_sqlcipher_sources_core="pdo_sqlite.c sqlite_driver.c sqlite_statement.c sqlite3.c"
dnl Detect PHP 8.4s DSN parser unit and compile it if present
AC_MSG_CHECKING([for sqlite_sql_parser.c (PHP 8.4 DSN parser)])
if test -f "$abs_srcdir/sqlite_sql_parser.c"; then
AC_MSG_RESULT([yes])
php_pdo_sqlcipher_sources_core="$php_pdo_sqlcipher_sources_core sqlite_sql_parser.c"
else
AC_MSG_RESULT([no])
fi
php_pdo_sqlcipher_sources_core="pdo_sqlcipher.c sqlcipher_driver.c sqlcipher_statement.c sqlcipher3.c"
PHP_NEW_EXTENSION(pdo_sqlcipher, $php_pdo_sqlcipher_sources_core, $ext_shared,,-I$pdo_inc_path)
PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlcipher_sources_core, $ext_shared,,-I$pdo_inc_path)
ifdef([PHP_ADD_EXTENSION_DEP],
[
PHP_ADD_EXTENSION_DEP(pdo_sqlcipher, pdo)
PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo)
])
fi

View file

@ -1,95 +0,0 @@
<?php
// database file name
$database = "example.db";
// database password
$password = "123456";
// returns new instance of PDO object
function getPDO($database) {
try {
$pdo = new PDO("sqlcipher:" . $database);
} catch (PDOException $e) {
die($e->getMessage() . PHP_EOL);
}
return $pdo;
}
//
// Create new example database with one table
// (it can be done through sqlcipher command line client)
//
$sql = "PRAGMA key = '$password';
PRAGMA encoding = \"UTF-8\";
PRAGMA auto_vacuum = 2;
PRAGMA incremental_vacuum(10);
CREATE TABLE `test` (
`id` INTEGER NOT NULL PRIMARY KEY,
`value` TEXT NOT NULL
);";
$pdo = getPDO($database);
if ($pdo->exec($sql) === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
//
// Use example database
//
// set encryption key before any sql command
$sql = "PRAGMA key = '$password'";
$pdo = getPDO($database);
if ($pdo->exec($sql) === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
// insert rows
$sql = "INSERT INTO `test` VALUES (1, 'value1');
INSERT INTO `test` VALUES (2, 'value2');
INSERT INTO `test` VALUES (3, 'value3');";
if ($pdo->exec($sql) === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
// select rows
$result = $pdo->query("SELECT * FROM `test`");
if ($result === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
foreach ($result as $row) {
print_r($row);
}
// alter table
$sql = "ALTER TABLE `test` RENAME TO `test2`";
if ($pdo->exec($sql) === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
// select rows
$result = $pdo->query("SELECT * FROM `test2`");
if ($result === false) {
$error = $pdo->errorInfo();
die($error[0] . ": " . $error[2] . PHP_EOL);
}
foreach ($result as $row) {
print_r($row);
}

View file

@ -1 +0,0 @@
/etc/php5/conf.d/pdo_sqlcipher.ini

View file

@ -1,12 +0,0 @@
Package: php5-sqlcipher
Version: _PHP_VER
Architecture: amd64
Maintainer: Anton Batenev <antonbatenev@yandex.ru>
Installed-Size: 350
Depends: libc6 (>= 2.13-38), libssl1.0.0 (>= 1.0.1e-2), _LIBICU (>= _LIBICU_VER), phpapi-_PHP_API, php5-common (= _PHP_DEB_VER)
Section: php
Priority: optional
Homepage: https://github.com/abbat/pdo_sqlcipher
Description: sqlcipher module for PHP 5
SQLCipher is an SQLite extension that provides transparent
256-bit AES encryption of database files.

View file

@ -1 +0,0 @@
extension=pdo_sqlcipher.so

View file

@ -1,4 +0,0 @@
This package was debianized by Anton Batenev <antonbatenev@yandex.ru>
pdo_sqlite under PHP License (http://www.php.net/license/3_0.txt)
sqlcipher under BSD-style open source license (http://sqlcipher.net/license)

View file

@ -1,7 +0,0 @@
php5-sqlcipher: debian-changelog-file-missing
php5-sqlcipher: hardening-no-relro
php5-sqlcipher: copyright-without-copyright-notice
php5-sqlcipher: binary-or-shlib-defines-rpath
php5-sqlcipher: embedded-library
php5-sqlcipher: hardening-no-fortify-functions
php5-sqlcipher: binary-without-manpage