Skip to content

Commit 6efe00b

Browse files
author
Michael Herold
committed
Updates build instructions and example
1 parent 84a257e commit 6efe00b

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

README.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,68 @@
11
php-systemd
2-
============
2+
===========
33

44
PHP extension allowing native interaction with systemd and journald
55

66
Installation
7-
============
7+
------------
8+
9+
### Prerequisites
10+
11+
.deb based
812

9-
sudo dnf install php-devel systemd-devel
1013
sudo apt install php5-dev libsystemd-dev
1114

15+
.rpm based
16+
17+
sudo dnf install php-devel systemd-devel
18+
19+
### Build
20+
1221
phpize
1322
./configure --with-systemd
1423
make
24+
25+
### Setup
26+
1527
sudo make install
28+
29+
Fedora
30+
1631
echo "extension=systemd.so" | sudo tee /etc/php.d/systemd.ini
32+
33+
Debian (PHP 5)
34+
35+
echo "extension=systemd.so" | sudo tee /etc/php5/mods-available/systemd.ini
36+
sudo php5enmod systemd
37+
38+
### Basic Test
39+
1740
echo "<?php echo sd_journal_send('MESSAGE=hello world');" | php
18-
41+
1942
Usage
20-
=====
43+
-----
2144

2245
Quick example:
2346

24-
<?php
25-
sd_journal_send('MESSAGE=Hello world.');
26-
sd_journal_send('MESSAGE=Hello, again, world.', 'FIELD2=Greetings!', 'FIELD3=Guten tag.');
27-
sd_journal_send('ARBITRARY=anything', 'FIELD3=Greetings!');
47+
``` {.php}
48+
<?php
49+
sd_journal_send('MESSAGE=Hello world.');
50+
sd_journal_send('MESSAGE=Hello, again, world.', 'FIELD2=Greetings!', 'FIELD3=Guten tag.');
51+
sd_journal_send('ARBITRARY=anything', 'FIELD3=Greetings!');
52+
```
2853

2954
Notes:
3055

31-
* Each argument must be in the form of a KEY=value pair, environmental variable style.
32-
* Unlike the native C version of journald's sd_journal_send(), printf-style substitution is not supported. Perform any substitution using PHP's sprintf() or similar capabilities first.
33-
* The base message is usually sent in the form MESSAGE=hello. The MESSAGE field is, however, not required.
34-
* Invalid arguments result in nothing recorded in the journal.
56+
- Each argument must be in the form of a KEY=value pair, environmental
57+
variable style.
58+
- Unlike the native C version of journald's `sd_journal_send()`,
59+
printf-style substitution is not supported. Perform any substitution
60+
using PHP's `sprintf()` or similar capabilities first.
61+
- The base message is usually sent in the form MESSAGE=hello. The
62+
MESSAGE field is, however, not required.
63+
- Invalid arguments result in nothing recorded in the journal.
3564

36-
Viewing Output
37-
==============
65+
### Viewing Output
3866

3967
Quick way to view output with all fields as it comes in:
4068

0 commit comments

Comments
 (0)