フィードアグリゲーター

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled.

planet postgresql - 2019-05-01(水) 10:02:06
On 4th of April 2019, Robert Haas committed patch: Allow VACUUM to be run with index cleanup disabled.     This commit adds a new reloption, vacuum_index_cleanup, which controls whether index cleanup is performed for a particular relation by default. It also adds a new option to the VACUUM command, INDEX_CLEANUP, which can be used … Continue reading "Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled."
カテゴリー: postgresql

Managing Multiple PHP versions via the ondrej/php PPA

planet PHP - 2019-05-01(水) 07:10:00

Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine.

Except this time, it wasn't. Due to updates I installed, I was getting errors first with compiling the GD extension, then with ext-intl:

  • If you want Freetype support in ext-gd, you are expected to install the package libfreetype-dev. On Ubuntu, this now installs libfreetype6-dev, which no longer includes the freetype-config binary that PHP's configure script uses to determine what features it supports.

  • Similarly, ext-intl depends on the package libicu-dev. Ubuntu's package now omits the icu-config binary used by PHP to determine feature support.

I searched for quite some time to find packages that would resolve these problems. I could have found the source code and compiled it and linked to that, but that would mean keeping that up-to-date on top of my PHP installs.

I even looked in the ondrej/php PPA, as that repository has multiple PHP versions already, including source packages.

And then I thought: why not try using those instead of phpbrew?

The rest of this post is how I made that work.

I use Ubuntu for my operating system. The instructions I present here should work on any Debian-based system, but your mileage may vary. If you are using an RPM-based system, yum will be your friend, but I have no idea how to add repositories in that system, nor if update-alternatives is available. As such, these instructions may or may not help you.

Which is okay. I mainly wrote them to help future me.

Register the PPA

First, I had to add the PPA to the system:

$ sudo add-apt-repository ppa:ondrej/ppa

Then the usual:

$ sudo apt update Approach to installation

I first identified the extensions I typically install, matched them to packages in the PPA, and made a list. I knew I'd be installing the same extensions across all PHP versions I wanted, so I figured I could script it a bit.

From there, I executed the following from the CLI:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> for EXTENSION in {listed all extensions here};do for for> sudo apt install php${VERSION}-${EXTENSION} for for> done for> done

This grabbed and installed each PHP I needed along with all extensions I wanted.

Switching between versions

To switch between versions, you have two options:

  • Use the version-specific binaries: /usr/bin/php5.6, /usr/bin/php7.0, etc.

  • Set a default via update-alternatives:

    $ sudo update-alternatives --set php /usr/bin/php5.6

    If you're not sure what you have installed, use:

    $ sudo update-alternatives --config php

    which will give you a listing, and an ability to select the one to use.

Rootless alternatives

What if you'd rather not be root to switch the default version, though? Fortunately, update-alternatives allows specifying alternate config and admin directories.

Define the following alias in your shell's configuration:

alias update-my-alternatives='update-alternatives \ --altdir ~/.local/etc/alternatives \ --admindir ~/.local/var/lib/alternatives'

Additionally, make sure you add $HOME/.local/bin to your $PATH; since defining $PATH varies based on the shell you use, I'll leave that for you to accomplish.

If you open a new shell, the alias will now be available; alternately, source the file in which you defined it to have it take effect immediately.

Once you've done that, you can run the following, based on the PHP versions you've installed:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> update-my-alternatives --install $HOME/.local/bin/php php /usr/bin/php${VERSION} ${VERSION//./0} for> done

This will create alternatives entries local to your own user, prioritizing them by version; as a result, the default, auto-selected version will be the most recently installed.

You can verify this by running update-my-alternatives --config php:

There are 5 choices for the alternative php (providing $HOME/.local/bin/php). Selection Path Priority Status ----------------

Truncated by Planet PHP, read more at the original (another 7281 bytes)

カテゴリー: php

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings.

planet postgresql - 2019-05-01(水) 03:22:52
On 3rd of April 2019, Tomas Vondra committed patch: Add SETTINGS option to EXPLAIN, to print modified settings.     Query planning is affected by a number of configuration options, and it may be crucial to know which of those options were set to non-default values. With this patch you can say EXPLAIN (SETTINGS ON) … Continue reading "Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings."
カテゴリー: postgresql

Technical Thoughts, Tutorials, and Musings: PSR-14: Example - PSR-14 in a non-blocking application server

phpdeveloper.org - 2019-05-01(水) 00:00:02

PSR-14: Example - PSR-14 in a non-blocking application server

We continue our exploration of PSR-14's potential with a guest post. Cees-Jan Kiewiet was the Sponsor of PSR-14 (meaning the member of the Core Committee who bridged from the Working Group to the Core Committee), and is on...
カテゴリー: php

Pine: Handy RegEx Constraints in Laravel Routes

phpdeveloper.org - 2019-05-01(水) 00:00:02

It’s a well-known feature, but still in some cases it may require longer research to find the good regex patterns for defining constraints for our route parameters. Let’s see some idea.

Getting Started First of all, let’s see how to even use patterns to create rules for our rout...

カテゴリー: php

Voices of the ElePHPant: Interview with Kathy Forte

phpdeveloper.org - 2019-05-01(水) 00:00:02

Show Notes Kathy’s LinkedIn profile

Audio

This episode is sponsored byDay Camp 4 Developers

The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

php[podcast] episodes from php[architect]: Frontend Fundamentals and Chris Hartjes

phpdeveloper.org - 2019-05-01(水) 00:00:02

In Episode 19 Eric, John, and Oscar record together again to discuss the April 2019 issue on the new frontend fundamentals, php[tek], and quite a lot more about web browsers than anyone anticipated. Topics Eric and John get a look behind the scenes into what goes into producing each magazine issu...

カテゴリー: php

423 Locked

planet PHP - 2019-05-01(水) 00:00:00

The 423 Locked status-code does not appear in the base HTTP specification, but is part of WebDAV specification, which is an extension to HTTP.

A major goal of WebDAV was to provide a ‘filesystem over the web’. One of its core features is for users to ‘lock’ specific files and directories to prevent others from editing them.

A user can lock a resource by issuing a http LOCK method and later on unlock the resource by using the UNLOCK HTTP method.

Both ‘shared locks’ and ‘exclusive locks’ are supported.

Example

Locking a resource

LOCK /article/5 HTTP/1.1 Content-Type: application/xml <?xml version="1.0"?> <d:lockinfo xmlns:d='DAV:'> <d:lockscope><d:exclusive/></d:lockscope> <d:locktype><d:write/></d:locktype> <d:owner>Evert</d:owner> </d:lockinfo>

A successful response to this includes a Lock-Token header.

HTTP/1.1 200 OK Content-Type: application/xml Lock-Token: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> <?xml version="1.0"?> ...

If a user tries to make a change to a locked resource, they will get an error:

PUT /article/5 HTTP/1.1 Content-Type: text/plain New content HTTP/1.1 423 Locked Content-Type: application/xml <?xml version="1.0" encoding="utf-8" ?> <d:error xmlns:d="DAV:"> <d:lock-token-submitted> <d:href>/article/5</d:href> </d:lock-token-submitted> </d:error>

Unless, they also include the lock-token in the If header:

PUT /article/5 HTTP/1.1 Content-Type: text/plain If: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> New content HTTP/1.1 204 No Content Usage on the web

I haven’t seen a lot of usage of LOCK, UNLOCK and the 423 code outside of WebDAV. However, I don’t see strong reasons against their usage.

A big part that the lock functionality of WebDAV hopes to solve, is avoiding problems with multiple users making updates on (groups of-) resources at the same time.

If you also have this issue, bear in mind that there is a more popular feature in HTTP to deal with this: Etags and the If-Match / If-None-Match headers.

These headers ten

Truncated by Planet PHP, read more at the original (another 1519 bytes)

カテゴリー: php

Community News: Latest PECL Releases (04.30.2019)

phpdeveloper.org - 2019-04-30(火) 22:05:01

Latest PECL Releases:

  • event 2.5.0
    Issue #53: Added EventConfig::setFlags() method. (There was no way to set EVENT_BASE_FLAG_* flags.)

  • uv 0.2.3
    - Fix Windows build - Fix PHP 7.4 build
  • gRPC 1.20.0
    - Added memory leak tests #17862 - Fixed segfault on accessing a closed client #18302 - Added ini settings for fork support #18539 - Fixed fork hang #18558
  • datadog_trace 0.20.0
    ### Added - Force tracing or discarding trace via special Span tag (manual.keep and manual.drop) #409 Fixed
    • Resource use by caching configuration values instead of processing data on every access #406
  • mysql_xdevapi 8.0.16
    WL#9879: Prepared statement support WL#11983: Support session-connect-attributes WL#12396: Support new session reset functionality orabug #28802543: classes: Driver, ExecutionStatus, Expression, and Statement orabug #28803208: the DocResult prototype appear wrong orabug #28803039: the fields() method seems odd orabug #28805757: how exactly are set() and replace() different?
カテゴリー: php

Eric Hanson: "Aquameta Revisited" on FLOSS Weekly

planet postgresql - 2019-04-30(火) 20:50:08

Eric talks about Aquameta 0.2 and the advantages of migrating the web stack into PostgreSQL on This Week in Tech's FLOSS Weekly.

カテゴリー: postgresql

Interview with Kathy Forte

planet PHP - 2019-04-30(火) 20:00:00

Show Notes Audio

This episode is sponsored by
Day Camp 4 Developers


The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

Markus Winand: A Close Look at the Index Include Clause

planet postgresql - 2019-04-30(火) 09:00:00

Some database—namely Microsoft SQL Server, IBM Db2, and also PostgreSQL since release 11—offer an include clause in the create index statement. The introduction of this feature to PostgreSQL is the trigger for this long overdue explanation of the include clause.

Before going into the details, let’s start with a short recap on how (non-clustered) B-tree indexes work and what the all-mighty index-only scan is.

Recap: B-tree Indexes

To understand the include clause, you must first understand that using an index affects up to three layers of data structures:

  • The B-tree

  • The doubly linked list at the leaf node level of the B-tree

  • The table

The first two structures together form an index so they could be combined into a single item, i.e. the “B-tree index”. I prefer to keep them separate as they serve different needs and have a different impact on performance. Moreover, explaining the include clause requires making this distinction.

In the general case, the database software starts traversing the B-tree to find the first matching entry at the leaf node level (1). It then follows the doubly linked list until it has found all matching entries (2) and finally it fetches each of those matching entries from the table (3). Actually, the last two steps can be interleaved, but that is not relevant for understanding the general concept.

The following formulas give you a rough idea of how many read operations each of these steps needs. The sum of these three components is the total effort of an index access.0

  • The B-tree: log100(<rows in table>), often less than 5

  • The doubly linked list: <rows read from index> / 100

  • The table: <rows read from table>1

When loading a few rows, the B-tree makes the greatest contribution to the overall effort. As soon as you need to fetch just a handful of rows from the table, this step takes the lead. In either case—few or many rows—the doubly linked list is usually a minor factor because it stores rows with similar values next to each other so that a single read operation can fetch

[...]
カテゴリー: postgresql

PSR-14: Example - PSR-14 in a non-blocking application server

planet PHP - 2019-04-30(火) 05:51:00
PSR-14: Example - PSR-14 in a non-blocking application server

We continue our exploration of PSR-14's potential with a guest post. Cees-Jan Kiewiet was the Sponsor of PSR-14 (meaning the member of the Core Committee who bridged from the Working Group to the Core Committee), and is on the core team for ReactPHP. One wouldn't think there's any use cases for PSR-14 in an async environment like React, but one would be wrong.

Here's Cees-Jan with an explanation:

Continue reading this post on SteemIt.

Larry 29 April 2019 - 3:51pm
カテゴリー: php

ページ