フィードアグリゲーター

PHP 7.2.20 Released

planet PHP - 2019-07-04(木) 09:00:00
The PHP development team announces the immediate availability of PHP 7.2.20. This is a bugfix release.All PHP 7.2 users are encouraged to upgrade to this version.For source downloads of PHP 7.2.20 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The list of changes is recorded in the ChangeLog.
カテゴリー: php

Running PHP applications on Azure App Engine

planet PHP - 2019-07-03(水) 19:02:00

Azure App Service is a way to host your web application in a container without having to think about the server. It's the same PaaS concept as AWS Elastic Beanstalk and supports all the main web programming languages. It also supports Windows and Linux OS containers.

I have a client that is moving an on-premises PHP application to App Service and so have been looking at what I needed to do to deploy it there.

To get started, Azure have a couple of great tutorials for Linux and Windows with which I got a basic app running in no time, so I could turn my attention to the specifics I cared about.

Database drivers

My app uses SQL Server, so I was pleased to see that both the Windows and Linux PHP containers have the sqlsrv extension installed. However, there's a bug today where the Linux container is missing the ODBC driver, so SQL Server support doesn't actually work on the Linux container. This should be fixed in July apparently.

Both containers also support PostgreSQL and MySQL, so the databases I care for are covered.

Rewriting all URLs to index.php in the public directory

In common with many PHP applications, I have a public directory where the files to be served by the web server are kept and my PHP and other source files are elsewhere. I also use rewriting to map all URLs to my public/index.php file.

The way we handle this depends on the container.

Windows container

On the Windows container, we need to change the path mapping so that the public directory is mapped to the /. This can be done in the web portal in Configuration -> Path mappings where by default the / virtual path is mapped to site\wwwroot physical path. Edit this so that it points to site\wwwroot\public. I'm not a fan of web-based tooling for things like this as it's error-prone. Azure provides a command line tool, so we can make the same path mapping change with:

$ az resource update --name web --resource-group {Resource Group} \ --namespace Microsoft.Web --resource-type config --parent sites/{App Service} \ --api-version 2015-06-01 \ --set properties.virtualApplications[0].physicalPath="site\wwwroot\public"

(Change {Resource Group} and {App Service} to the correct names for your installation.)

Now that we're serving from /public, we can now add the rewrite rule. With IIS, we use a web.config file:

/public/web.config:

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Pretty URLs to index.php" stopProcessing="true"> <match url="^(.*)

quot; />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Linux container

On Linux, the container runs Apache, so we can rewrite the URL to public/index.php with a single .htaccess file in our root directory:

/.htaccess:

RewriteEngine On RewriteBase / # Rewrite static files that live in public/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.(woff|ttf|svg|js|ico|gif|jpg|png|css|htc|xml|txt|pdf)$ /public/$1.$2 [L,NC] # Redirect all other URLs to public/index.php RewriteRule ^((?!public/).*)$ public/index.php/$1 [L,QSA]

Two rewrite rules are required: firstly we rewrite static files so that the continue to be served by Apache and then we rewrite everything else to index.php.

Environment variables

Environment variables are a common way to set per-installation configuration and this is done vie the portal or the command line:

$ az webapp config appsettings set --name {App Service} \ --resource-group {Resource Group} \ --settings \ ENV_VAR_1="some value" \ ENV_VAR_2="some other value"

Summary

Running a PHP application on Azure App Engine with either the Windows or Linux container is much the same as on any other hosting and seems to work well.

カテゴリー: php

Pavel Golub: Bulding PostgreSQL (x86, x64) and OpenSSL using MSYS2 and MinGW under Windows

planet postgresql - 2019-07-03(水) 17:00:43

I’ve written already a blog post “Building PostgreSQL with MSYS2 and MinGW under Windows” a year ago. But this time I want to show you two important things:

  1. cross compiling (x86, x64) using the same run-time;
  2. compiling with the latest OpenSSL support.

That’s true nowadays you won’t find binaries or installations of PostgreSQL without OpenSSL support. It used not only for encryption but for compression as well.

Even though it’s Windows, let’s make all steps in command prompt only. Ya, I told you Linux guys, we can run console too!

Setting up the environment

First things first. I launch my msys2 shell. I assume you have it on your system, if not check installation instructions from my previous post.

c:\msys64\ is the msys2 installation folder.

C:\Users\pasha>c:\msys64\msys2_shell.cmd -mingw64 -conemu

I’m telling msys2 to run shell and use -mingw64 as a default chain. That means we will build x64 binaries. -conemu is an optional parameter, you may want to pass it in case you’re a fan of ConEmu as I am. If not, just skip it.

pasha@PG480 MINGW64 ~ $ mkdir /src pasha@PG480 MINGW64 ~ $ cd /src pasha@PG480 MINGW64 /src $ git clone https://github.com/openssl/openssl.git --branch OpenSSL_1_1_1-stable --depth 1 Cloning into 'openssl'... remote: Enumerating objects: 18297, done. remote: Counting objects: 100% (18297/18297), done. remote: Compressing objects: 100% (15182/15182), done. remote: Total 18297 (delta 884), reused 14976 (delta 582), pack-reused 0 Receiving objects: 100% (18297/18297), 13.48 MiB | 1.38 MiB/s, done. Resolving deltas: 100% (884/884), done. Checking out files: 100% (18166/18166), done. pasha@PG480 MINGW64 /src $ git clone https://github.com/postgres/postgres.git --branch REL_11_STABLE --depth 1 Cloning into 'postgres'... remote: Enumerating objects: 5868, done. remote: Counting objects: 100% (5868/5868), done. remote: Compressing objects: 100% (5365/5365), done. remote: Total 5868 (delta 754), reused 1296 (delta 317), pack-reused 0 Receiving objects: 100% (5[...]
カテゴリー: postgresql

Building what’s in front of you

planet PHP - 2019-07-03(水) 04:42:00

Recently while working on an application I found myself asking a number of architectural questions. These were questions about things that I might consider “fundamental” – elements of the application, how many methods each class might receive, and how to put it all together into something cohesive. You might have asked yourself some of the […]

The post Building what’s in front of you appeared first on BrandonSavage.net.

カテゴリー: php

500 Internal Server Error

planet PHP - 2019-07-03(水) 00:00:00

While the 4xx-series errors are specifically for client-side errors, the 5xx-series errors are for server-side errors.

A server-side error generally means that there is a bug or outage. If you are developing a client and you encounter a 5xx-range error, generally you can assume it wasn’t your fault, and it might even be worth contacting the maintainers of the web service you’re trying to use.

The first error in this series is 500 Internal Server Error. This is a generic error, and a good error to choose if there is not a more specific error suitable for your problem.

Many server-side error handlers automatically convert any uncaught exception into this error code.

Example HTTP/1.1 500 Internal Server Error Content-Type text/plain We broke it, sorry! References
カテゴリー: php

Doug Hunley: How the CIS Benchmark for PostgreSQL 11 Works

planet postgresql - 2019-07-02(火) 19:28:00

Crunchy Data has recently announced an update to the CIS PostgreSQL Benchmark by the Center for Internet Security, a nonprofit organization that provides publications around standards and best practices for securing technologies systems. This newly published CIS PostgreSQL 11 Benchmark joins the existing CIS Benchmarks for PostgreSQL 9.5, 9.6, and 10 while continuing to build upon Crunchy Data's efforts with the PostgreSQL Security Technical Implementation Guide (PostgreSQL STIG).

カテゴリー: postgresql

Voices of the ElePHPant: Interview with Sebastian Feldmann

phpdeveloper.org - 2019-07-02(火) 03:00:02
@movetodevnull

Show Notes Captain Hook PHPBU Sebastian's Blog

Audio

This episode is sponsored by Uncle Cal's Career Advice for Developers

The post Interview with Sebastian Feldmann appeared first on Voices of the ElePHPant.

カテゴリー: php

That Podcast: Episode 60: The One Where We Talk Twig, Drupal, and Sculpin with Oliver Davies

phpdeveloper.org - 2019-07-02(火) 03:00:02

Oliver Davies@opdavieshttps://www.oliverdavies.uk/

カテゴリー: php

Webslesson: Laravel 5.8 Tutorial - File Upload with Progress Bar using Ajax

phpdeveloper.org - 2019-07-02(火) 03:00:02

If you are looking for Laravel 5.8 web tutorial for learn How to Upload File or Image in Laravel 5.8 with Progress bar for display uploading process, then you have come on right place because you can find complete step by step tutorial for display uploading process in progress bar using Ajax jQuery ...

カテゴリー: php

Mera Mustaqbil: 16 Laravel Pro Tips and Tricks

phpdeveloper.org - 2019-07-02(火) 03:00:02

1: Auto Model Validation Automatically validate model or anything you want to perform before save, update or create. 2: Prevent Update Some times you want to prevent update on any model, for this purpose you can use code written below: 3: Get Random Rows Get random rows from a table using Eloquent: ...

カテゴリー: php

murze.be: ★ How to handle front-end authorization using Laravel, Inertia and TypeScript

phpdeveloper.org - 2019-07-02(火) 03:00:02

Recently Jeffrey Way published a video titled "Frontend Authorization Brainstorming" on Laracasts. In that video, he shows three ways of passing authorization results to the front-end. Currently I'm working on a big project that uses Inertia, React and TypeScript. In this blog post, I won't cover t...

カテゴリー: php

Louise Grandjonc: PostgreSQL's indexes - GIN algorithms

planet postgresql - 2019-07-02(火) 02:20:22
Introduction In the previous article, I introduced the internal data structure of a postgres GIN index. Now it’s time to talk about searching and maintaining them. Searching in a GIN index When postgres uses the GIN index, you’ll notice in the EXPLAIN that it’s always doing a bitmap heap scan. It means that the search algorithm returns a map of tids (pointers to rows) in physical memory order. Considering the way the data is stored inside the posting lists and trees, it makes a lot of sense to use this method.
カテゴリー: postgresql

Louise Grandjonc: PostgreSQL's indexes - GIN

planet postgresql - 2019-07-02(火) 02:20:21
Introduction GIN (Generalized Invertes Index) indexes are often used to index arrays, jsonb, and tsvector (for fulltext search) columns. When it comes to array, they are, for example, used to verify if an array contains an other array or elements (the <@ operator). In the documentation you can see the full list of operators. But the question that I want to answer in this article is: “why should we use GIN indexes for this data types and operators ?
カテゴリー: postgresql

Ibrar Ahmed: Deep Dive Into PostgreSQL Indexes Webinar: Q & A

planet postgresql - 2019-07-01(月) 22:39:13

I want to thank everybody who attended my session “Deep Dive in PostgreSQL Indexes” in Austin. It was quite a wonderful experience! To cover a bigger audience, I also did a webinar on the same topic. There were many questions in that webinar, but unfortunately, there was not enough time to cover each and every question, so I decided to have a followup Q&A session with a blog post on the topic.

The recording and slides are available here. Below is the list of your questions.

Q1: Is there a concept of the functional index in PostgreSQL?

The functional index is when an index is defined on the result of a function. This is present in PostgreSQL 7. In later releases of PostgreSQL, you can define the index on the result of an expression. The expression can be any PostgreSQL expression. The function is a subset of expression.

Q2: Can I create an index using a table row data that is attached to the index? Does my query have to use index-only-scan?

Yes, if all selected columns are in the index, then index-only-scans will be used.

Q3: It’s a little bit hard to choose the right index type. Is there any offer mechanism in Postgres for index types?

Yes, that’s true that is hard to choose, but it all depends on your data and queries types. I have mentioned recommendations in my slides. There is no mechanism for that in PostgreSQL.

Q4: Is it possible to manipulate which index is used by a query if you have multiple indexes?

No, it’s optimizer’s responsibility to choose between defined the indexes. Believe that the PostgreSQL optimizer will choose the best option for you.

Q5: If there’s a need to index a date column, would it be better to use B-TREE or BRIN index?

A date data type is mostly aligned with physical storage. If you are not making many updates and delete operations, then go for the BRIN. But if you have too many updates and deletes, then B-TREE is best for you.

Q6: For time-based filters what kind of index is preferable?

Time is also aligned with physical storag

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

Hans-Juergen Schoenig: PostgreSQL meets “Data Science and AI”

planet postgresql - 2019-07-01(月) 18:40:51

Machine Learning, Deep Learning, Artificial Intelligence, and Data Science have become really important topics these days. Everybody is looking for new technologies and tries to make use of those recent developments. PostgreSQL can help to achieve those goals, and it offers reliable backend storage for your data.

PostgreSQL vs. CSV files vs. commercial databases

In the past we have seen that many in the Data Science and AI community are still using CSV files to process data. While there is a lot of tooling available (e.g. the Python pandas library) it might not be the best of all decision to build your models on CSV files.

So what is wrong with a CSV file? Well, actually nothing as long as …

  • the format of your file is correct
  • the amount of data is reasonable
  • ALL the data in the file is needed
  • nothing changes

All those points might seem obvious BUT my practical experience shows that they are not and that those issues are seriously underappreciated. What do I mean by that?

Recently we have seen a customer, who wanted to store interest rates for some financial models. What did we find in the data? Let me quote: “3 percent” (as a string). Now: How do you expect your AI models to work if the data is so wrong? To do data mining you will need high quality data – not some crap. Which leads to an important observation:

“If you are doing Artificial Intelligence 80% of your effort has to go into data preparation – only 20% are the real model”

In short: You cannot seriously expect a model to learn something about “interest rates” if the raw data does not even ensure that the interest rate is actually a number.

The second remark is about the amount of data: Suppose you got a TB of data. If you want to process or maybe sort your data. What do you think? Who is better at sorting? A database, which has been optimized to sort data for 30 years or some hand written Python program, which you have written over a weekend? From experience I can tell you: You got no chance. The d

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

Regina Obe: PostGIS 3.0.0alpha3

planet postgresql - 2019-07-01(月) 09:00:00

The PostGIS development team is pleased to release PostGIS 3.0.0alpha3.

This release works with PostgreSQL 9.5-12beta2 and GEOS >= 3.6

Best served with PostgreSQL 12beta2.

Continue Reading by clicking title hyperlink ..
カテゴリー: postgresql

Dave Page: Indexing Documents for Full Text Search

planet postgresql - 2019-07-01(月) 00:28:00
During a conversation with $BOSS a couple of days ago the topic of the new Full Text Search in MongoDB came up. He (knowing of, but presumably having never worked with FTS in PostgreSQL) suggested I might create a tool like the one the MongoDB guys were proudly showing off in their keynote video from their recent conference to make it easy to index and search HTML documents on disk. I looked at him with a slight tilt of the head and remarked that it's already easy to do that, and just takes a few lines of Python code or similar.

So, here I am on my flight back to the UK having written 36 lines of code whilst munching on my breakfast and enjoying my free seat upgrade. I should probably note that those 36 lines of code include import statements, comments, blank lines for readability, and a nicely formatted 7 line SQL query that could easily be just one line. Plus, the vast majority of the code is really just boilerplate to read a directory of files and extract their contents.

Anyway, before I can go into that, it was necessary to first create a schema to hold the data we'd need to query. This is basically just a table to hold whatever information you like about each document, with a tsvector column for searching. For my test I decided to make the path to the file the primary key, and to store the title of the HTML document and the text in the body. The body text isn't really needed, but it does make it a touch easier to use a trigger to automatically maintain the tsvector data - plus of course, I could also then use that column and get rid of the source documents.

Here's what the table looked like:

  CREATE TABLE docs
  (
      path text NOT NULL,
      title text NOT NULL,
      body text NOT NULL,
      tsv tsvector NOT NULL,
      PRIMARY KEY (path)
  );

  CREATE INDEX docs_tsv_idx
      ON docs USING gin (tsv);

I also added the aforementioned trigger to maintain the tsvector. I got slightly fancy with this, indexing both the title and the body fields, and giving the[...]
カテゴリー: postgresql

Laravel News: Debugging .gitignore

phpdeveloper.org - 2019-06-30(日) 00:00:01
Sometimes you might create a file that is unexpectedly ignored by git. Although it doesn’t happen often, it can be tricky to figure out which .gitignore file is responsible for ignoring a file in your project. It is super easy once you know about a handy git co...
カテゴリー: php

colinodell.com - Blog: league/commonmark 1.0.0 has been released!

phpdeveloper.org - 2019-06-29(土) 23:22:21

After 5 years of development, 3,000,000 downloads, and 58 releases, I'm extremely pleased to announce that league/commonmark version 1.0.0 has been released! What is league/commonmark? league/commonmark is a highly-extensible PHP Markdown parser which is fully compliant with the CommonMark spec. ...

カテゴリー: php

ページ