From 84a257ea1ec14e728e91f1d116517296f0256f51 Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Fri, 10 Jun 2016 00:16:12 +0200 Subject: [PATCH 1/4] Fixes outdated build config Build working on debian stretch --- README.md | 4 +++- config.m4 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e181798..cd80bef 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ PHP extension allowing native interaction with systemd and journald Installation ============ - sudo yum install -y php-devel systemd-devel + sudo dnf install php-devel systemd-devel + sudo apt install php5-dev libsystemd-dev + phpize ./configure --with-systemd make diff --git a/config.m4 b/config.m4 index 728c1b3..de64f36 100644 --- a/config.m4 +++ b/config.m4 @@ -5,7 +5,7 @@ PHP_ARG_WITH(systemd, enable support for systemd, if test "$PHP_SYSTEMD" != "no"; then SEARCH_PATH="/usr /usr/local" - SEARCH_FOR="/include/sd-journal.h" + SEARCH_FOR="/include/systemd/sd-journal.h" SYSTEMD_DIR= @@ -32,7 +32,7 @@ if test "$PHP_SYSTEMD" != "no"; then PHP_ADD_INCLUDE($SYSTEMD_DIR/include) - LIBNAME=systemd-journal + LIBNAME=systemd LIBSYMBOL=sd_journal_sendv if test "x$PHP_LIBDIR" = "x"; then From 6efe00bc4cabd60733046c65e2cd82ccae9f766f Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Fri, 10 Jun 2016 00:44:52 +0200 Subject: [PATCH 2/4] Updates build instructions and example --- README.md | 58 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index cd80bef..a37d640 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,68 @@ php-systemd -============ +=========== PHP extension allowing native interaction with systemd and journald Installation -============ +------------ + +### Prerequisites + +.deb based - sudo dnf install php-devel systemd-devel sudo apt install php5-dev libsystemd-dev +.rpm based + + sudo dnf install php-devel systemd-devel + +### Build + phpize ./configure --with-systemd make + +### Setup + sudo make install + +Fedora + echo "extension=systemd.so" | sudo tee /etc/php.d/systemd.ini + +Debian (PHP 5) + + echo "extension=systemd.so" | sudo tee /etc/php5/mods-available/systemd.ini + sudo php5enmod systemd + +### Basic Test + echo " Date: Fri, 10 Jun 2016 00:49:06 +0200 Subject: [PATCH 3/4] Updates example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a37d640..f13e280 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ Quick example: ``` {.php} Date: Fri, 10 Jun 2016 21:53:54 +0200 Subject: [PATCH 4/4] Adds fixes for PHP 7.0 --- systemd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/systemd.c b/systemd.c index 9479556..1eaf98b 100644 --- a/systemd.c +++ b/systemd.c @@ -30,11 +30,11 @@ ZEND_GET_MODULE(systemd) PHP_FUNCTION(sd_journal_send) { struct iovec *iov = NULL; - zval ***args; + zval *args; int argc, len, i; char *val; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) != SUCCESS) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "+", &args, &argc) != SUCCESS) { return; } @@ -46,10 +46,10 @@ PHP_FUNCTION(sd_journal_send) } // Iterate through the PHP arguments and fill the iovector. - for (i = 0; i < ZEND_NUM_ARGS() TSRMLS_CC; ++i) { - convert_to_string_ex(args[i]); - val = Z_STRVAL_PP(args[i]); - len = Z_STRLEN_PP(args[i]); + for (i = 0; i < argc; ++i) { + convert_to_string_ex(&args[i]); + val = Z_STRVAL(args[i]); + len = Z_STRLEN(args[i]); iov[i].iov_base = val; iov[i].iov_len = len; }