Install the following requirements:
brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq
Within the app directory run the following commands in different panes.
ruby worker.rb
<?php | |
class Foo | |
{ | |
// ... | |
protected function spawnProcess() | |
{ | |
if (!function_exists('proc_open')) { | |
throw new \RuntimeException( |
// Go encourages us to organize our code using goroutines and to use | |
// channels of channels to implement request-response semantics [1]. | |
// | |
// I have encountered far more instances that require acknowledgment | |
// than fully-fledged respones so I became curious whether channels | |
// of channels were indeed the best implementation strategy. | |
// | |
// In summary, yes, they are. These benchmarks demonstrate that | |
// channels perform better than mutexes, that condition variables are | |
// still clumsy, and that preallocation is a huge win when and if you |
<?php | |
include_once "zmtp.php"; | |
// This was connecting to a libzmq master based subscriber. | |
$host = "127.0.0.1"; | |
$port = 4422; | |
// Connect and send null mechanism. | |
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); | |
$rc = socket_connect($socket, $host, $port); |
Install the following requirements:
brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq
Within the app directory run the following commands in different panes.
ruby worker.rb
/* | |
Copyright (c) 2020 Chan Jer Shyan | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
<?php | |
// ZMTP/2.0 http://rfc.zeromq.org/spec:15 | |
// ZMTP/1.0 http://rfc.zeromq.org/spec:13 | |
$fp = fsockopen("127.0.0.1", 5559, $errno, $errstr, 1); | |
if (!$fp) { | |
return; | |
} | |
stream_set_timeout($fp, 0, 500); |
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
# Ubuntu Server | |
export DEBIAN_FRONTEND=noninteractive | |
echo -e "\e[96m Adding PPA \e[39m" | |
sudo add-apt-repository -y ppa:ondrej/apache2 |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Sine Wave</title> | |
<script type="text/javascript"> | |
function showAxes(ctx,axes) { | |
var width = ctx.canvas.width; | |
var height = ctx.canvas.height; | |
var xMin = 0; |
cmake_minimum_required(VERSION 3.5) | |
project(extname | |
VERSION 1.0.0 | |
LANGUAGES C) | |
message(STATUS "Begin cmaking of PHP extension ...") | |
if (NOT CMAKE_BUILD_TYPE) | |
set(CMAKE_BUILD_TYPE Debug CACHE STRING |
The following steps will describe how to build PHP from source including PHP's Apache module as it is no longer part of macOS starting with macOS Monterey.
If this is for a development environment, you can simply install PHP with Homebrew using the command brew install php
. This guide is for cases where you need a more portable PHP without heavily dependening on external libraries.