在线 vscode 配置 php xdebug code-server

Arm 版请看 code-server vscode arm

通知 xdebug 请添加 xdebug.remote_autostart = 1
Notify Xdebug to add xdebug.remote_ autostart = 1

检查/root/code-server/path中的文件
Check the files in / root / code server / path

View

image-20210212010743794

image-20210212011307032

image-20210212013820201

Install

aliyun

docker run -it -d \
--name vs-db \
-p 8003:3306 \
--hostname vs-db \
-e "MYSQL_ROOT_PASSWORD=123456" \
mariadb:latest

docker run -it -d \
--name vscode \
-v /yourpath/www/html:/var/www/html \
-p 31001:8080 \
-p 31002:80 \
-p 31003:22 \
--hostname vscode \
--link vs-db \
registry.cn-hangzhou.aliyuncs.com/zygds/vscode-open:latest

docker

docker run -it -d \
--name vs-db \
-p 8003:3306 \
--hostname vs-db \
-e "MYSQL_ROOT_PASSWORD=123456" \
mariadb:latest

docker run -it -d \
--name vscode \
-v /yourpath/www/html:/var/www/html \
-p 31001:8080 \
-p 31002:80 \
-p 31003:22 \
--hostname vscode \
--link vs-db \
zygds/vscode:latest

Readme

因为 yum install mariadb-server出现问题,所以采用docker mariadb 的方式
Because there is a problem with Yum install MariaDB server, docker MariaDB is used

将docker中的/var/www/html映射到你自己的工作目录
Map / var / www / HTML in docker to your own working directory

-v /yourpath/www/html:/var/www/html \ 

在 vscode 中,可以直接使用 vs-db:3306 连接数据库
In vscode, you can directly use vs DB: 3306 to connect to the database

--link vs-db \

Then

我们先访问vscode
Let’s go to vscode first

image-20210212022724821

Turn on SSH

cat code-server/vscode.sh | grep ssh
/usr/sbin/sshd -D &

Open SSL

首先把你的证书文件上传到 vscode,或者将你的文件拖拽到 vscode 即可上传
First, upload your certificate file to vscode, or drag your file to vscode to upload

vi /root/.config/code-server/config.yaml

bind-addr: 0.0.0.0:8080
auth: password
password: passwd
cert: true

重启vscode容器
Restart the vscode container

docker restart vscode
docker exec -it vscode /bin/bash
cd /root/.local/share/code-server
cp /root/xrsec.key localhost.key
cp /root/xrsec.crt localhost.crt
exit
docker restart vscode

然后可以注意到右上角,需要配置ssl才能使用
Then you can notice in the upper right corner that you need to configure SSL to use it

image-20210212023530539

image-20210212023722967

就像真的vscode一样
It’s like real vscode

Xdebug

php74-fpm && nginx
php54-fpm && nginx

在页面上打开/var/www/html
Open /var/www/html on the page

使用php debug插件进行断点测试
Breakpoint testing with PHP debug plug-in

接着访问web 页面,例如192.168.0.188:33095
Then visit the web page, such as 192.168.0.188:33095

Other

pecl74 install 
pecl56 install

/root/code-server/vscode.sh

/root/code-server/server/php/php56/lib/php.ini
/root/code-server/server/php/php74/lib/php.ini
/etc/nginx/nginx.conf
/etc/proxychains.conf
/etc/ssh/sshd_config
/root/.ssh
/root/.zshrc
/root/.pip/pip.conf
/root/.gitconfig

Bug

当切换到小程序时候 然后切换目录时会页面无响应,可能是pwa的问题,只需要用浏览器打开即可
When you switch to the applet and then switch to the directory, the page will not respond. It may be a problem with PWA. You just need to open it with a browser

image-20210212025357794

image-20210212025446227

然后正常显示
Then it will be displayed normally

All steps

#!bin/bash
/usr/bin/code-server &
/bin/bash
# yum install zsh vim make cmake gcc gcc-c++ libxml2 libxml2-devel git \
# nodejs zip unzip sqlite-devel m4 autoconf nginx tree \
# krb5-devel openssl openssl-devel curl curl-devel libjpeg \
# libjpeg-devel libpng libpng-devel freetype freetype-devel \
# pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel \
# openssh-server iputils net-tools -y


########################################
# php74
# ./configure --prefix=/root/code-server/server/php/php74 --with-curl \
# --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 \
# --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear \
# --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash \
# --enable-fpm --enable-bcmath --enable-inline-optimization \
# --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap \
# --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml

# make && make install

########################################

# *****************************************

# php56
# ./configure --prefix=/root/code-server/server/php/php56 --with-curl \
# --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 \
# --with-mysqli --with-pdo-mysql --with-pdo-sqlite --with-pear \
# --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash \
# --enable-fpm --enable-bcmath --enable-inline-optimization \
# --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap \
# --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml

# make && make install

# *****************************************

########################################

# oniguruma
# ./configure --prefix=/usr
# make && make install

########################################

# cp /root/code-server/server/vscode.png /usr/lib/code-server/src/browser/media/pwa-icon-512.png
# cp /root/code-server/server/vscode.png /usr/lib/code-server/src/browser/media/pwa-icon-192.png

# /root/code-server/server/php/php56/sbin/php-fpm
# /root/code-server/server/php/php56/sbin/php-fpm

# chmod -R 777 /var/www/html && chown -R www-data:www-data /var/www/html


# README
# 启动命令
# vscode
# php74-fpm
# php56-fpm
# nginx -s reload

# phpstorm
# /usr/sbin/sshd -D &

# # /usr/libexec/mysqld start mysql我不玩了,玩不来,装不上

# chmod 700 ~/.ssh
# chmod 644 ~/.ssh/authorized_keys

# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key

如果你喜欢这个项目,欢迎推荐给朋友使用

If you like this project, welcome to recommend it to your friends