PHP
Infinite Servers
GitLab Open Source Live servers.infinitescript.com Introduction Infinite Servers is a self-hosted server fleet monitor built around a single design constraint: the agent must run completely unprivileged. Each monitored host installs a PHP script that runs as nobody, reads /proc, and pushes status every 15 seconds to a central dashboard. No root access, no persistent daemon with elevated privileges, no external database server. This design was motivated by the security risks that plague popular alternatives. Tools like Nezha require agents to run as root, which creates a severe blast-radius problem: if the dashboard is compromised, an attacker can push arbitrary commands to every connected host with full system privileges. Two recent CVEs illustrate just how real this risk is:
Create Unit Testing Cases in Zend Framework
A solid unit test suite is essential for ongoing development in large projects, especially those with many people involved. Going back and manually testing every individual component of an application after every change is impractical. Your unit tests will help alleviate that by automatically testing your application’s components and alerting you when something is not working the same way it was when you wrote your tests. The Zend Framework 2 API uses PHPUnit, and so does this tutorial application. A detailed explanation of unit testing is beyond the scope of this tutorial, so we will only provide sample tests for the components in the pages that follow. This tutorial assumes that you already have PHPUnit installed.
Create CDN View Helper in Zend Framework 2
In this article, you will learn how to create a custom view helper in Zend Framework 2. A concrete example will be used; a helper which generates links for a subdomain, intended for storing static files. This is especially useful if you wish to use a Content Delivery Network (CDN). With very little modification, the helper can be made generic to support links to subdomains for all purposes. Note: Zend Framework 2 has reached end of life. In 2019 the project moved to the Linux Foundation and was renamed Laminas, so the Zend\ namespaces below are now Laminas\ (for example Zend\View\Helper\AbstractHelper becomes Laminas\View\Helper\AbstractHelper). The view-helper mechanics are otherwise unchanged, so this post is kept as a historical walkthrough. For a real project, run the namespaces through the Laminas migration guide and follow the current custom view helper docs.
Building and Installing HHVM on CentOS 7
What’s HHVM? HHVM is an open-source virtual machine designed for executing programs written in Hack and PHP. Instead of interpreting PHP directly, it uses a just-in-time (JIT) compiler to reach much higher throughput while staying compatible with existing PHP code. Facebook, which created HHVM, reported roughly a 9x gain in web request throughput and a 5x drop in memory use over the old PHP 5.2 + APC engine, and back in 2015 HHVM could run most of the popular PHP frameworks out of the box.
TestZilla
GitLab Open Source Introduction Crowd testing is a software testing approach where a distributed group of real users, rather than an in-house QA team, tests a product across a wide variety of devices, operating systems, and usage scenarios. The goal is to surface bugs that structured internal testing tends to miss, at a fraction of the cost of a dedicated test lab. TestZilla is an open-source crowd testing platform designed to connect two parties: hunters (volunteer testers who find and report bugs) and developers (product owners who register their software and receive the reports). Hunters earn points for accepted reports, creating a lightweight incentive loop that encourages quality submissions. The project started as a Spring MVC application and was later fully rebuilt using the Phalcon framework to support a faster continuous delivery workflow.
Build Tengine, MariaDB and PHP on Ubuntu 14.04
Introduction Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. Tengine is a branch of Nginx which is created by Alibaba Inc. MariaDB is a database server developed by some of the original authors of MySQL and offers drop-in replacement functionality. Note: This guide is from 2014 and builds every component from source on Ubuntu 14.04, which has long since reached end-of-life. On a current system you would install Tengine/Nginx, MariaDB, and PHP from the official APT repositories and manage them with systemd instead of the SysV init.d scripts shown below. It’s kept here as a historical walkthrough.
Difference Between require and include in PHP
One of the most common questions I get from PHP beginners is: why are there four different ways to pull one file into another? There is include, include_once, require, and require_once. They look almost interchangeable, but picking the wrong one can either hide a fatal bug or crash a page that should have kept running. The four are really just combinations of two independent choices: include vs require: what happens when the file is missing. include emits a warning and keeps going; require stops the script with a fatal error. plain vs _once: how many times the file may be loaded. The plain form loads the file on every call; the _once form loads it at most once per request. One note before we start: despite the parentheses you often see, include and require are language constructs, not functions. Both require 'core.php'; and require('core.php'); work, but the manual recommends the parenthesis-free form, which is what I’ll use throughout.
Sending Email with Zend Framework 2 Using Template
Sending a templated HTML email is a one-liner in some frameworks, but Zend Framework 2 ships no such helper, so you have to wire up the view renderer, the MIME message, and the transport yourself. This post walks through that setup. Note: Zend Framework 2 has reached end of life. In 2019 the project moved to the Linux Foundation and was renamed Laminas; the Zend\* classes shown below now live under Laminas\* (e.g. Laminas\Mail, Laminas\View). The technique is unchanged, so this post still applies once you swap the namespaces.