local web server solutions
Docker-based solution
Meet Laradock, a full PHP development environment based on Docker.
- Install Docker for your OS
- Use git to clone the Laradock repo
- Copy the env-example file to .env in your project root
- Modify the new .env file with services you want
- docker-compose up -d …
Dockerfile
DEBIAN_FRONTEND
ENV DEBIAN_FRONTEND=noninteractive |
DEBIAN_FRONTEND 环境变量,告知操作系统应该从哪儿获得用户输入。
如果设置为”noninteractive”,你就可以直接运行命令,而无需向用户请求输入(所有操作都是非交互式的)。
这在运行 apt-get 命令的时候格外有用,因为它会不停的提示用户进行到了哪步并且需要不断确认。
非交互模式会选择默认的选项并以最快的速度完成构建。请确保只在 Dockerfile 中调用的 RUN 命令中设置了该选项,而不是使用 ENV 命令进行全局的设置。
因为 ENV 命令在整个容器运行过程中都会生效,所以当你通过 BASH 和容器进行交互时,如果进行了全局设置那就会出问题。
install swoole
https://github.com/swoole/swoole-src/blob/v4.5.11/package.xml
在安装过程中它会询问是否要启用某些功能,这也可以在运行安装之前提供:
# php7.1 |
enable-openssl
验证方法:
php -r "new swoole_server('0.0.0.0', 443, SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL);" |
docker-composer.yml
extra_hosts: |
会在启动后的服务容器中 /etc/hosts 文件中添加:
10.0.75.1 dockerhost |
PHP Extensions
pcov
PCOV - CodeCoverage compatible driver for PHP.
https://github.com/krakjoe/pcov
phpdbg
phpdbg aims to be a lightweight, powerful, easy to use debugging platform for PHP.
https://www.php.net/manual/en/book.phpdbg.php
blackfire
Blackfire APM Observability From Development to Production.
Taint
amqp
gearman
xlswriter
pcntl
Exif
Aerospike
The multi-model, NoSQL real-time data platform for multi-cloud, large-scale JSON and SQL use cases.
smbclient
imap
Calendar
Phalcon
APCU
newrelic
cachetool
CacheTool allows you to work with APCu, OPcache, and the file status cache through the CLI. It will connect to a FastCGI server (like PHP-FPM) and operate on its cache.
https://github.com/gordalina/cachetool
other
PPA
Personal Package Archive (PPA)
&& apt-get install -y software-properties-common \ |
dnsutils
powerline
Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including zsh, bash, tmux, IPython, Awesome and Qtile.
https://github.com/powerline/powerline
hashicorp
Build your zero trust security strategy.
lnav
https://github.com/tstack/lnav
aerospike
The Multi-Model Real-Time Data Platform.
deployer
The PHP deployment tool with support for popular frameworks out of the box.
event
https://pecl.php.net/package/event
https://www.cnblogs.com/52fhy/p/9258040.html
phalcon
A full-stack PHP framework delivered as a C-extension.
ssdb
SSDB is a high performance NoSQL database, an alternative for Redis.
https://ideawu.github.io/ssdb-docs/php/index.html
zmq
ZeroMQ for PHP.
https://github.com/zeromq/php-zmq
swoole
https://wiki.swoole.com/#/version/supported
https://stackoverflow.com/questions/59820378/pecl-install-how-to-specify-options
it’s been there since Nov 2019 / v1.10.10 https://github.com/pear/pear-core/pull/90
pear upgrade –force pear
- PHP7.0 4.3.6
- PHP7.1 4.5.11
- PHP7.2~8.1 4.8.x
- PHP8.0~8.1 5.0.x
Commands
sed
# Change application source from deb.debian.org to aliyun source |
https://qianngchn.github.io/wiki/4.html
docker
docker build –tag yifans/php-workspace:main-7.1 -f ./Dockerfile-7.1 .
docker run -d fd73afb17bcb
docker run -v $PWD:/var/www –rm laradock-workspace:latest php -m
update-alternatives
https://man7.org/linux/man-pages/man1/update-alternatives.1.html