Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Delicious Brains:
Hosting WordPress Yourself: Moving WordPress to a New Server
Oct 30, 2018 @ 14:50:42

On the DeliciousBrains.com site they've posted the latest installment for their "Hosting WordPress Yourself" series (part 12) showing how to move your WordPress installation over to a new server.

In part 11 of Hosting WordPress Yourself I demonstrated how to update a server’s packages (including PHP). However, I didn’t show how to upgrade the server itself, because it’s not something I recommend.

[...] In this article, I’m going to walk you through the steps required to migrate an existing WordPress site to a new server. These are the same steps that I took just a few months ago to migrate the Delicious Brains site to a new server with little to no downtime.

The rest of the article is broken up into several different sections, each with descriptions and commands/code you'll need:

  • Securely Copying Files
  • File Migration
  • Nginx Configuration
  • HTTPS Certificates
  • Spoof DNS
  • Database Import

They also include hints on migrating with minimum downtime and things to look out for when you "flip the switch".

tagged: wordpress migration different server tutorial series part12

Link: https://deliciousbrains.com/move-wordpress-new-server/

Laravel News:
Laravel Dump Server to Ship With Laravel 5.7
Aug 16, 2018 @ 14:16:03

In a quick post to the Laravel News site they mention another new feature coming in the v5.7 release of the framework: the addition of the dump server for debugging output.

At Laracon US 2018 Taylor Otwell announced that Laravel Dump Server would come packaged with Laravel in version 5.7! It will be a development dependency in laravel/laravel composer file.

Starting in Laravel 5.7 you’ll get this command out-of-the-box that allows you to dump data to the console or an HTML file instead of to the browser.

The post outlines what the "dump server" provides and provides an example of the command used to start it up. You can find out more about the dump server in this previous article.

tagged: laravel dump server debugging version dependency

Link: https://laravel-news.com/laravel-dump-server-laravel-5-7

SitePoint PHP Blog:
How To Boost Your Server Performance With Varnish
Jul 06, 2018 @ 14:20:23

The SitePoint PHP blog has posted the latest tutorial in their series creating a simple image gallery application with a focus on performance. In this latest article they cover the use of Varnish for output and page caching.

According to Pingdom.com, a company focused on web performance, in 2012 Varnish was already famous among the world’s top websites for its capacity to speed up web delivery.

[...] Although there are other solutions that also shine, Varnish is still a go-to solution that can dramatically improve website speed, reduce the strain on the web application server’s CPU, and even serve as a protection layer from DDoS attacks. KeyCDN recommends deploying it on the origin server stack.

Varnish can sit on a dedicated machine in case of more demanding websites, and make sure that the origin servers aren’t affected by the flood of requests.

The article starts by explaining a bit about how Varnish (and caching in general) works to help improve the performance for the end user. It also goes through some of the basics feature of Varnish including threaded executions, extensibility and its domain-specific language. The tutorial then walks you through the installation of Varnish on a linux-based machine and shares some example stats showing the difference between normal requests and when Varnish is enabled for the image gallery application.

tagged: server performance varnish tutorial series imagegallery optimization

Link: https://www.sitepoint.com/how-to-boost-your-server-performance-with-varnish/

Sergey Zhuk:
Fast Web Scraping With ReactPHP. Part 3: Using Proxy
Jun 26, 2018 @ 17:27:43

Sergey Zhuk has posted the third part of his series covering the use of ReactPHP to scrape content from another source on the web. In this third part of the series he improves on his scripts from before (scraping from the IMDB site) to add in a proxy server.

n the previous article, we have created a scraper to parse movies data from used a simple in-memory queue to avoid sending hundreds or thousands of concurrent requests and thus to avoid being blocked. But what if you are already blocked? The site that you are scraping has already added your IP to its blacklist and you don’t know whether it is a temporal block or a permanent one.

Such issued can be resolved with a proxy server. Using proxies and rotating IP addresses can prevent you from being detected as a scraper.

He then shows how to use the clue/reactphp-buzz package to write an asynchronous HTTP request to google.com making use of promises rather than normal synchronous request handling. He then installs the clue/reactphp-socks package to make the connection to the proxy server(s) and modifies the Buzz client to use that as a connection. After finding a proxy server to use, he updates the scraper code created previously with the new Buzz+Socks combination and shows it in action scraping data. The post finishes with a look at adding some error handling and how to handle when the proxy requests authentication before use.

tagged: web scraping tutorial series part3 reactphp buzz socks proxy server

Link: https://sergeyzhuk.me/2018/06/20/fast-webscraping-with-reactphp-proxy/

TutsPlus.com:
Set Up an OAuth2 Server Using Passport in Laravel
Jun 08, 2018 @ 16:51:36

The TutsPlus.com site has a new tutorial posted showing you how to create an OAuth2 server with Laravel and the help of the Passport library.

In this article, we’re going to explore how you could set up a fully fledged OAuth2 server in Laravel using the Laravel Passport library. We’ll go through the necessary server configurations along with a real-world example to demonstrate how you could consume OAuth2 APIs.

I assume that you’re familiar with the basic OAuth2 concepts and flow as we’re going to discuss them in the context of Laravel. In fact, the Laravel Passport library makes it pretty easy to quickly set up an OAuth2 server in your application. Thus, other third-party applications are able to consume APIs provided by your application.

The article is then divided up into the steps (code, configuration changes, and commands) required to get the system up and running:

  • Installation of Passport (requires a Laravel app already installed)
  • Changing the User model to add the "remember_token" field
  • Setting up some demo resources
  • Adding the middleware and routes to handle the requests

The tutorial then spends some time showing how to consume OAuth2 APIs and makes use of the Passport "client" to make some sample requests. Finally, it walks you through the whole process of the OAuth2 experience from a user perspective, including some code to manually make the connection from plain PHP.

tagged: tutorial oauth2 server laravel passport client token

Link: https://code.tutsplus.com/tutorials/setup-oauth2-server-using-passport-in-laravel--cms-30576

Sergey Zhuk:
Amp Promises: Using Router With ReactPHP Http Component
Mar 13, 2018 @ 14:25:37

Sergey Zhuk has a post on his site that covers using a Router with a ReactPHP component. This router lets you more easily direct the HTTP requests coming into the application to the correct piece of functionality.

Router defines the way your application responds to a client request to a specific endpoint which is defined by URI (or path) and a specific HTTP request method (GET, POST, etc.). With ReactPHP Http component we can create an asynchronous web server. But out of the box the component doesn’t provide any routing, so you should use third-party libraries in case you want to create a web-server with a routing system.

He starts with an example of manual routing, showing the code for a basic server and adding in handlers based on the path+HTTP verb to respond with different content. He expands this basic example out to a more "real world" situation of the usual CRUD handling for "tasks". The post then shows how to change things up and use the FastRoute routing package to remove the manual route definitions from the server and define them in the router instead. It can then dispatch these to the correct location more easily. The post finishes up showing an additional feature: how to use wildcards in these URL definitions.

tagged: reactphp server http router fastroute tutorial series

Link: http://sergeyzhuk.me/2018/03/13/using-router-with-reactphp-http/

Three Devs & A Maybe:
Build, Provision and Deploy in the Cloud with Thijs Feryn
Feb 16, 2018 @ 17:31:13

The Three Devs and a Maybe podcast, with hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann, has posted their latest episode with special guest Thijs Feryn talking about the build/provision/deploy pipeline "in the cloud".

In this weeks episode we are joined by Thijs Feryn to discuss his upcoming PHP UK conference talk. We start of the show highlighting what drew him to a Tech. evangelist role, bridging the gap between code/infrastructure and the ideas behind ‘Infrastructure as Code’. From here we move on to discuss system and infrastructure provisioning automation tools such Ansible and Terraform. This leads on to adding Packer into the mix, moving towards immutable infrastructure, testing these automation tools and how history has a way of repeating itself. Finally, we touch upon the philosophy behind DevOps, focusing on empathy and its core values CAMS.

You can listen to this latest episode either by using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: threedevsandamaybe podcast thijsferyn build provision deploy cloud server

Link: http://threedevsandamaybe.com/build-provision-and-deploy-in-the-cloud-with-thijs-feryn/

Medium.com:
Laravel 5.6 Preview - Single Server Scheduling
Nov 30, 2017 @ 15:40:46

On the Medium.com site today Laravel project lead and creator Taylor Otwell has posted about a feature coming in the 5.6 release of the Laravel framework: single server scheduling.

Today Laurence Ioannou, founder of the Laravel monitoring application Eyewitness.io, contributed a great new feature to Laravel 5.6 (February 2018 release): single server scheduling.

He illustrates the new feature by first defining a new "inspire" job, making it run hourly with the artisan command and not overlap with a previous execution. While this works with a simple server, it doesn't scale to multiple - that's where the "single server scheduling" comes in. The addition of this support provides a new onOneServer option that prevents the job from running elsewhere. It makes use of Redis or Memcache to store the information about which server it is running on so that will need to be enabled to use this feature.

tagged: laravel preview laravel56 single server scheduling job

Link: https://medium.com/@taylorotwell/laravel-5-6-preview-single-server-scheduling-54df8e0e139b

CloudWays Blog:
Speed Up PHP Application Deployments Via Laravel’s Envoyer
Aug 01, 2017 @ 16:49:42

The Cloudways blog has a new tutorial posted showing you how to speed up your deployment using Envoyer, a service from the Laravel ecosystem that's used to push code to an environment in an automated way.

Envoyer is a deployment tool used to deploy PHP applications. The best thing about the the tool is the zero downtime during deployment. This means that your application and the customers using it are not even aware of the fact that a new version has been pushed.

Envoyer works well with major repository management platforms such as GitLab and Bitbucket. Other benefits include unlimited deployments and team members. The following blog will guide you through the process of deploying applications on Cloudways using Envoyer.

The tutorial then walks you through creating an Envoyer account, connect it to a repository and set up the server to deploy the code to. They then show how to set up the deployment itself, make the push to the server and configure any post-deployment steps that may need to be performed. Screenshots are included in each step of the process so you can be sure you're on the right path.

tagged: laravel envoyer deployment tutorial introduction process configuration server

Link: https://www.cloudways.com/blog/php-laravel-envoyer-deployment/

Sergey Zhuk:
Build A Simple Chat With ReactPHP Socket: Server
Jun 28, 2017 @ 15:46:39

Sergey Zhuk has a new post to his site showing how you can use ReactPHP's socket component to build a simple chat service as a server runing on a remote port.

In this article, we are going to build a simple chat server based on ReactPHP Socket Component. With this component, we can build simple async, streaming plaintext TCP/IP or a secure TLS socket server.

There are client and server sockets. The server is bound to a specific port number and just waits listening on this port. The client knows the host of the server and the port on which the server is listening. When the connection between server and client is established, the data exchange begins.

He then gets into the code required to make the server and add in some additional functionality. He starts by creating the server to listen for incoming connections and has it write back a simple message to prove it's working correctly. He then moves on to the code required for sending and receiving data. This initial version just echoes back what the user submits. He takes this an expands it out to start on the intiial steps of the chat system - creating the connection pool for multiple clients, storing usernames of those connected and using that information when transmitting a message to all clients connected.

tagged: simple reactphp chat server tutorial server client username

Link: http://seregazhuk.github.io/2017/06/22/reactphp-chat-server/


Trending Topics: