为了详细记录我的PHP和Python开发环境的配置,方便自己查看,故作此文。本文为原创作品,未经允许禁止转载!技术水平有限,欢迎大牛指点。
序号 | 环境 | 版本 |
---|---|---|
1. | 物理机 |
小米笔记本电脑Pro15.6 (内存16G 固态硬盘2T) |
2. | 宿主OS |
Windows 10 专业版 |
3. | 虚拟机环境 |
VMware® Workstation 15 Pro 15.5.1 build-15018445 |
4. | 客户机OS |
Deepin 15.11 桌面版 (下载地址:https://www.deepin.org/) |
5. | 客户机OS 类型选择 |
Linux(L) |
6. | 客户机OS 版本选择 |
Ubuntu 64位 |
7. | 客户机 内存设置 |
4096M(4G) |
8. | 客户机 硬盘设置 |
100G |
9. | 客户机 CPU设置 |
1个CPU,每个CPU2个核心 |
10. | 客户机 CD/DVD镜像路径 |
D:\Virtual Machines\deepin-15.11-amd64.iso |
11. | 客户机 显示器设置 |
监视器数量2 分辨率1920x1080 |
12. | 客户机 网络适配器设置 |
桥接模式直接连接到物理网络 |
13. | 客户机 共享目录设置 |
D:\Virtual Machines\Deepin-Share-Dir\D (名称设置为为D) |
14. | 客户机命名 |
Deepin15.11-03-9 (-03-09是安装日期) |
15. | 客户机安装目录 |
D:\Virtual Machines\Deepin15.11-03-9 |
16. | 客户机系统账户名称 |
wdh |
(程序的重要数据或文件存放在Win10映射进来的目录)
mkdir D sudo vmhgfs-fuse .host:/D /home/wdh/D -o subtype=vmhgfs-fuse,allow_other,nonempty
###查看共享目录:
vmware-hgfsclient
点击左下角启动器-》找到计算机-》右键 发送到桌面
cp ~/Downloads/navicat15-premium-cs.AppImage ~/D/Downloads
cp ~/Downloads/navicat15-premium-cs.AppImage ~/D/bin/navicat
chmod +x ~/D/bin/navicat/navicat15-premium-cs.AppImage
[Desktop Entry]
Comment=Navicat.
Comment[zh_CN]=数据库管理工具
Exec=/home/wdh/D/bin/navicat/navicat15-premium-cs.AppImage %f
GenericName=Navicat
GenericName[zh_CN]=Navicat数据库管理
Name=Navicat
Name[zh_CN]=Navicat
StartupNotify=false
Terminal=false
Type=Application
Icon=/home/wdh/D/bin/navicat/navicat.png
在应用商店中搜索:QQ,点击安装或者更新QQ(wine版),并等待安装或更新完成,到应用程序列表,找到QQ,右键发送到桌面
在应用商店中搜索:钉钉,点击安装或者更新钉钉(wine版),安装完成后到应用程序列表,找到钉钉,右键发送到桌面
在应用商店中搜索:Sublime,点击安装或者更新Sublime,并等待安装或更新完成,到应用程序列表,找到Sublime,右键发送到桌面
在应用商店中搜索:360,点击安装或者更新360,并等待安装或更新完成,到应用程序列表,找到360,右键发送到桌面
在应用商店中搜索:phpStorm,点击安装或者更新 JetBrains Toolbox,并等待安装或更新完成,打开 JetBrains Toolbox 在列表中找到 phpStorm 选择安装最新版本,到应用程序列表,找到phpStorm,右键发送到桌面
apt-get install git
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=SmartGit
Keywords=git;svn;subversion
GenericName=Git-Client
Type=Application
Categories=Development;RevisionControl
Terminal=false
StartupNotify=true
StartupWMClass=SmartGit
Exec="//home/wdh/D/bin/smartgit/bin/smartgit.sh" %u
MimeType=x-scheme-handler/git;x-scheme-handler/smartgit;x-scheme-handler/sourcetree;
Icon=/home/wdh/D/bin/smartgit/bin/smartgit-256.png
可以从应用商店直接安装,也可以下载安装:https://www.jetbrains.com/pycharm/ 选择下载专业版(Professional)
tar -xvf pycharm-professional-2019.3.3.tar.gz
mv -r pycharm-2019.3.3 ~/D/bin/
[Desktop Entry]
Comment=Pycharm.
Comment[zh_CN]=Pycharm
Exec=/home/wdh/D/bin/pycharm-2019.3.3/bin/pycharm.sh %f
GenericName=Pycharm
GenericName[zh_CN]=Pycharm
Icon=/home/wdh/D/bin/pycharm-2019.3.3/bin/pycharm.png
Name=Pycharm
Name[zh_CN]=Pycharm
StartupNotify=false
Terminal=false
Type=Application
X-Deepin-Vendor=user-custom
apt-get -y install python3-pip
pip3 install --upgrade pip3
pip3 --default-timeout=100 install -U xgboost
sudo pip3 --default-timeout=100 install -U xgboost -i https://pypi.mirrors.ustc.edu.cn/simple/
wdh@wdh:~$ sudo pip3 --default-timeout=100 install -U xgboost -i https://pypi.mirrors.ustc.edu.cn/simple/
Collecting xgboost
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/70/91/551d37ba472bcbd70a25e667acc65a18a9d053657b13afcf0f87aa24d7bb/xgboost-1.0.2-py3-none-manylinux1_x86_64.whl (109.7MB)
100% |████████████████████████████████| 109.8MB 17kB/s
Collecting scipy (from xgboost)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/c1/60/8cbf00c0deb50a971e6e3a015fb32513960a92867df979870a454481817c/scipy-1.4.1-cp35-cp35m-manylinux1_x86_64.whl (26.0MB)
100% |████████████████████████████████| 26.0MB 68kB/s
Collecting numpy (from xgboost)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/52/e6/1715e592ef47f28f3f50065322423bb75619ed2f7c24be86380ecc93503c/numpy-1.18.1-cp35-cp35m-manylinux1_x86_64.whl (19.9MB)
100% |████████████████████████████████| 20.0MB 88kB/s
Installing collected packages: numpy, scipy, xgboost
Successfully installed numpy-1.18.1 scipy-1.4.1 xgboost-1.0.2
(tensorflow) wdh@wdh:~$
bash ~/D/Downloads/Anaconda3-2019.10-Linux-x86_64.sh 安装,中途提示,按 enter 或 输入yes
export PATH=/home/wdh/anaconda3/bin:$PATH
conda --version
source ~/anaconda3/bin/activate 和:anaconda-navigator
touch anaconda.sh
chomd +x anaconda.sh
#!/bin/bash
source /home/wdh/anaconda3/bin/activate;
anaconda-navigator;
[Desktop Entry]
Comment=Anaconda.
Comment[zh_CN]=Anaconda
Exec=/home/wdh/anaconda3/anaconda.sh %f
GenericName=Anaconda
GenericName[zh_CN]=Anaconda
Icon=/home/wdh/anaconda3/lib/python3.7/site-packages/anaconda_navigator/static/images/anaconda.png
Name=Anaconda
Name[zh_CN]=Anaconda
StartupNotify=false
Terminal=false
Type=Application
X-Deepin-Vendor=user-custom
source ~/.bashrc
配置永久远程访问Jupyter 的方法:
运行以下命令,生成配置文件/home/wdh/.jupyter/jupyter_notebook_config.py:
jupyter notebook --generate-config
然后修改里面的配置:
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = ‘0.0.0.0’
(base) wdh@wdh:~$ conda create -n tensorflow
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/wdh/anaconda3/envs/tensorflow
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate tensorflow
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) wdh@wdh:~$
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp36-cp36m-linux_x86_64.whl
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
conda install numpy
anaconda search -t conda tensorflow
anaconda show jjh_cio_testing/tensorflow
conda install --channel https://conda.anaconda.org/jjh_cio_testing tensorflow
$ python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
ImportError: No module named 'tensorflow'
则按教程解决:https://blog.csdn.net/zinkin14/article/details/79235314
步骤如下:
pip3 install --upgrade -I setuptools
wdh@wdh:~$ pip3 install --upgrade -I setuptools
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/70/b8/b23170ddda9f07c3444d49accde49f2b92f97bb2f2ebc312618ef12e4bd6/setuptools-46.0.0-py3-none-any.whl (582kB)
100% |████████████████████████████████| 583kB 79kB/s
Installing collected packages: setuptools
Successfully installed setuptools-46.0.0
wdh@wdh:~$
pip3 install --upgrade --ignore-installed tensorflow
如果安装不成功,则切换国内源安装:
wdh@wdh:~$ sudo pip3 --default-timeout=100 install -U tensorflow -i https://pypi.mirrors.ustc.edu.cn/simple/
Collecting tensorflow
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/7c/fb/7b2c5b3e85ad335b53ca67deb2ef4af574dc0a8759f43b7f45e15005e449/tensorflow-1.14.0-cp35-cp35m-manylinux1_x86_64.whl (109.2MB)
100% |████████████████████████████████| 109.2MB 17kB/s
Requirement already up-to-date: numpy<2.0,>=1.14.5 in /usr/local/lib/python3.5/dist-packages (from tensorflow)
Collecting termcolor>=1.1.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting astor>=0.6.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl
Collecting keras-applications>=1.0.6 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl (50kB)
100% |████████████████████████████████| 51kB 166kB/s
Collecting wheel>=0.26 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting wrapt>=1.11.1 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/82/f7/e43cefbe88c5fd371f4cf0cf5eb3feccd07515af9fd6cf7dbf1d1793a797/wrapt-1.12.1.tar.gz
Collecting absl-py>=0.7.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/1a/53/9243c600e047bd4c3df9e69cfabc1e8004a82cac2e0c484580a78a94ba2a/absl-py-0.9.0.tar.gz (104kB)
100% |████████████████████████████████| 112kB 259kB/s
Collecting gast>=0.2.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl
Collecting six>=1.10.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting tensorboard<1.15.0,>=1.14.0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/91/2d/2ed263449a078cd9c8a9ba50ebd50123adf1f8cfbea1492f9084169b89d9/tensorboard-1.14.0-py3-none-any.whl (3.1MB)
100% |████████████████████████████████| 3.2MB 373kB/s
Collecting grpcio>=1.8.6 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/53/28/c3e07546941b45bdb840918bf9854d75529c80b79a2445d0ba7acf5d68dc/grpcio-1.27.2-cp35-cp35m-manylinux1_x86_64.whl (2.7MB)
100% |████████████████████████████████| 2.7MB 445kB/s
Collecting tensorflow-estimator<1.15.0rc0,>=1.14.0rc0 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/3c/d5/21860a5b11caf0678fbc8319341b0ae21a07156911132e0e71bffed0510d/tensorflow_estimator-1.14.0-py2.py3-none-any.whl (488kB)
100% |████████████████████████████████| 491kB 122kB/s
Collecting google-pasta>=0.1.6 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/c3/fd/1e86bc4837cc9a3a5faf3db9b1854aa04ad35b5f381f9648fbe81a6f94e4/google_pasta-0.1.8-py3-none-any.whl (57kB)
100% |████████████████████████████████| 61kB 1.2MB/s
Collecting keras-preprocessing>=1.0.5 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/28/6a/8c1f62c37212d9fc441a7e26736df51ce6f0e38455816445471f10da4f0a/Keras_Preprocessing-1.1.0-py2.py3-none-any.whl (41kB)
100% |████████████████████████████████| 51kB 1.6MB/s
Collecting protobuf>=3.6.1 (from tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/ef/56/10999d97e62eba72a12ebd147d806fa702ab82a620e28f6bc3e5d2c59e34/protobuf-3.11.3-cp35-cp35m-manylinux1_x86_64.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 702kB/s
Collecting h5py (from keras-applications>=1.0.6->tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/10/56/d5c53cd170529bb40cd7dd43e2b68944cb65a45f65ab4c78a68f4ac9e51e/h5py-2.10.0-cp35-cp35m-manylinux1_x86_64.whl (2.8MB)
100% |████████████████████████████████| 2.8MB 432kB/s
Collecting markdown>=2.6.8 (from tensorboard<1.15.0,>=1.14.0->tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/ab/c4/ba46d44855e6eb1770a12edace5a165a0c6de13349f592b9036257f3c3d3/Markdown-3.2.1-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 968kB/s
Collecting werkzeug>=0.11.15 (from tensorboard<1.15.0,>=1.14.0->tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/ba/a5/d6f8a6e71f15364d35678a4ec8a0186f980b3bd2545f40ad51dd26a87fb1/Werkzeug-1.0.0-py2.py3-none-any.whl (298kB)
100% |████████████████████████████████| 307kB 931kB/s
Collecting setuptools>=41.0.0 (from tensorboard<1.15.0,>=1.14.0->tensorflow)
Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/70/b8/b23170ddda9f07c3444d49accde49f2b92f97bb2f2ebc312618ef12e4bd6/setuptools-46.0.0-py3-none-any.whl (582kB)
100% |████████████████████████████████| 583kB 766kB/s
Building wheels for collected packages: termcolor, wrapt, absl-py
Running setup.py bdist_wheel for termcolor ... done
Stored in directory: /root/.cache/pip/wheels/3c/68/02/0a86bd7e89e3dfa33677c7016bdd2be8ec7a6f2e922fd6dc48
Running setup.py bdist_wheel for wrapt ... done
Stored in directory: /root/.cache/pip/wheels/ae/3f/d1/28aa048852b3560e84aea628d174534c905f79bc8b738f278f
Running setup.py bdist_wheel for absl-py ... done
Stored in directory: /root/.cache/pip/wheels/a5/c0/5b/1ec56f4d3e11c8c33bd3e94880265e968d1e651d75e2dcdc6c
Successfully built termcolor wrapt absl-py
Installing collected packages: termcolor, astor, six, h5py, keras-applications, wheel, wrapt, absl-py, gast, grpcio, setuptools, markdown, protobuf, werkzeug, tensorboard, tensorflow-estimator, google-pasta, keras-preprocessing, tensorflow
Found existing installation: six 1.10.0
Not uninstalling six at /usr/lib/python3/dist-packages, outside environment /usr
Found existing installation: wheel 0.29.0
Not uninstalling wheel at /usr/lib/python3/dist-packages, outside environment /usr
Found existing installation: setuptools 33.1.1
Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed absl-py-0.9.0 astor-0.8.1 gast-0.3.3 google-pasta-0.1.8 grpcio-1.27.2 h5py-2.10.0 keras-applications-1.0.8 keras-preprocessing-1.1.0 markdown-3.2.1 protobuf-3.11.3 setuptools-46.0.0 six-1.14.0 tensorboard-1.14.0 tensorflow-1.14.0 tensorflow-estimator-1.14.0 termcolor-1.1.0 werkzeug-1.0.0 wheel-0.34.2 wrapt-1.12.1
wdh@wdh:~$
$ source activate tensorflow
$ python
参照地址:https://mp.csdn.net/console/editor/html/103747924
#卸载旧版本Docker,旧版本Docker被称为docker,docker.io或docker-engine。
sudo apt-get remove docker docker-engine docker.io containerd runc
#更新apt包索引
sudo apt-get update
#安装 apt 依赖包,用于通过 HTTPS 来获取仓库。
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
#添加 Docker 的官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
#通过搜索指纹 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 验证指纹是否存在。
sudo apt-key fingerprint 0EBFCD88
#编辑软件源设置文件
sudo vim /etc/apt/sources.list
#在文件末尾添加官方源
deb https://download.docker.com/linux/debian stretch stable
#更新包索引
sudo apt-get update
#安装Docker:安装最新版本的 Docker Engine-Community 和 containerd
sudo apt-get install docker-ce docker-ce-cli containerd.io
#查看已安装Docker版本
sudo docker verison
#修改Docker镜像仓库为国内加速地址
sudo vim /etc/docker/daemon.json
#写入内容:
{"registry-mirrors":["https://cr.console.aliyun.com"]}
#重启docker服务使其生效,至此修改就生效了
sudo service docker restart
#查看docker容器
sudo docker ps
#如果报以下错误:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
#则,将当前用户加入docker组,然后退出当前用户比如切换为root,再次切换回去即可。
sudo gpasswd -a ${USER} docker
#如果root用户没有密码,则设置root密码
sudo passwd root
#切换到 root(需输入密码)
su root
#再切换回 wdh
su wdh
#切换到mysql本地镜像的dockerfile所在目录
cd /home/wdh/D/nmpr/mysql
#开始构建 (命令中的 点 . 是指当前目录)
docker build -t hengda/mysql5.7:v1 .
#切换到php本地镜像的dockerfile所在目录
cd /home/wdh/D/nmpr/php
#开始构建
docker build -t hengda/php7.2-fpm:v1 .
#切换到nginx本地镜像的dockerfile所在目录
cd /home/wdh/D/nmpr/nginx
#开始构建
docker build -t hengda/nginx1.8:v1 .
#切换到redis本地镜像的dockerfile所在目录
cd /home/wdh/D/nmpr/redis
#开始构建
docker build -t hengda/redis5.0:v1 .
可以参照这里:https://www.jianshu.com/p/a2b65e8aad74
sudo curl -L https://github.com/docker/compose/releases/download/1.25.0-rc2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
cd /home/wdh/D/nmpr/
./nmpr-restart.sh
启动输出结果:
wdh@wdh:~/D/nmpr$ ./nmpr-restart.sh
Removing network nmpr_redis-master-net
WARNING: Network nmpr_redis-master-net not found.
Removing network nmpr_redis-slave-net
WARNING: Network nmpr_redis-slave-net not found.
Removing network nmpr_redis-cluster-net
WARNING: Network nmpr_redis-cluster-net not found.
Removing network nmpr_hengda-mysql-net
WARNING: Network nmpr_hengda-mysql-net not found.
Removing network nmpr_hengda-php-net
WARNING: Network nmpr_hengda-php-net not found.
Removing network nmpr_hengda-nginx-net
WARNING: Network nmpr_hengda-nginx-net not found.
Creating network "nmpr_redis-master-net" with driver "bridge"
Creating network "nmpr_redis-slave-net" with driver "bridge"
Creating network "nmpr_redis-cluster-net" with driver "bridge"
Creating network "nmpr_hengda-mysql-net" with driver "bridge"
Creating network "nmpr_hengda-php-net" with driver "bridge"
Creating network "nmpr_hengda-nginx-net" with driver "bridge"
Creating redis-master2 ... done
Creating redis-slave3 ... done
Creating redis-slave1 ... done
Creating redis-master1 ... done
Creating redis-master3 ... done
Creating redis-slave2 ... done
Creating hengda-mysql ... done
Creating hengda-php ... done
Creating hengda-nginx ... done
Creating redis-cluster ... done
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
wdh@wdh:~/D/nmpr$
wget https://mirrors.aliyun.com/composer/composer.phar
sudo chmod +x composer.phar
sudo mv composer /bin/composer
查看composer版本:
composer --version
更改composer镜像源为国内地址
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
或者:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
或者:
composer config -g repo.packagist composer https://packagist.laravel-china.orgd
sudo apt-get install -y openssh-server -y
php -m
wdh@wdh:~/D/nmpr/nginx/WWW/www_test$ php7.0 -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
验证本机是否已经安装某扩展
查看PHP 扩展文件所在的目录:
php7.0 -i | grep extension
extension_dir => /usr/lib/php/20151012 => /usr/lib/php/20151012
mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.
查看扩展目录下已经存在的扩展:
ls /usr/lib/php/20151012
calendar.so exif.so ftp.so iconv.so mbstring.so pdo.so posix.so shmop.so sysvmsg.so sysvshm.so
ctype.so fileinfo.so gettext.so json.so opcache.so phar.so readline.so sockets.so sysvsem.so tokenizer.so
如果有指定的扩展文件名,说明本机已安装该扩展,如果没有则需要重新安装:
例如安装 mbstring:
sudo apt-get install
如果扩展文件已存在则需将扩展添加到php7.0配置文件:
sudo vim /etc/php/7.0/cli/php.ini
添加配置项:
extension=mbstring.so
chmod -R 777 /home/wdh/D/nmpr/nginx/www/www_test/
composer create-project --prefer-dist laravel/laravel blog "5.5.*"
报错:
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
解决办法:
sudo apt-get -y install php-dom
安装正常的输出结果:
(base) wdh@wdh:~/D/nmpr/nginx/www/www_test$ rm -rf blog
(base) wdh@wdh:~/D/nmpr/nginx/www/www_test$ composer create-project --prefer-dist laravel/laravel blog "5.5.*"
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
Creating a "laravel/laravel" project at "./blog"
Installing laravel/laravel (v5.5.28)
- Installing laravel/laravel (v5.5.28): Loading from cache
Created project in /home/wdh/D/nmpr/nginx/www/www_test/blog
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 77 installs, 0 updates, 0 removals
- Installing kylekatarnls/update-helper (1.2.0): Downloading (100%)
- Installing symfony/thanks (v1.2.5): Downloading (100%)
- Installing symfony/polyfill-ctype (v1.14.0): Downloading (100%)
- Installing vlucas/phpdotenv (v2.6.1): Downloading (100%)
- Installing symfony/css-selector (v3.4.38): Downloading (failed)
Downloading (100%)
- Installing tijsverkoyen/css-to-inline-styles (2.2.2): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.14.0): Downloading (100%)
- Installing symfony/var-dumper (v3.4.38): Downloading (100%)
- Installing symfony/routing (v3.4.38): Downloading (100%)
- Installing symfony/process (v3.4.38): Downloading (100%)
- Installing psr/log (1.1.2): Downloading (100%)
- Installing symfony/debug (v3.4.38): Downloading (100%)
- Installing symfony/polyfill-php72 (v1.14.0): Downloading (100%)
- Installing symfony/polyfill-intl-idn (v1.14.0): Downloading (100%)
- Installing paragonie/random_compat (v9.99.99): Downloading (100%)
- Installing symfony/polyfill-php70 (v1.14.0): Downloading (100%)
- Installing symfony/http-foundation (v3.4.38): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing symfony/event-dispatcher (v3.4.38): Downloading (100%)
- Installing symfony/polyfill-util (v1.14.0): Downloading (100%)
- Installing symfony/polyfill-php56 (v1.14.0): Downloading (100%)
- Installing symfony/http-kernel (v3.4.38): Downloading (100%)
- Installing symfony/finder (v3.4.38): Downloading (100%)
- Installing symfony/console (v3.4.38): Downloading (100%)
- Installing symfony/polyfill-iconv (v1.14.0): Downloading (100%)
- Installing doctrine/lexer (1.0.2): Downloading (100%)
- Installing egulias/email-validator (2.1.17): Downloading (100%)
- Installing swiftmailer/swiftmailer (v6.2.3): Downloading (100%)
- Installing ramsey/uuid (3.9.3): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Downloading (100%)
- Installing symfony/translation (v3.4.38): Downloading (100%)
- Installing nesbot/carbon (1.39.1): Downloading (100%)
- Installing mtdowling/cron-expression (v1.2.3): Downloading (100%)
- Installing monolog/monolog (1.25.3): Downloading (100%)
- Installing league/flysystem (1.0.65): Downloading (100%)
- Installing erusev/parsedown (1.7.4): Downloading (100%)
- Installing doctrine/inflector (v1.2.0): Downloading (100%)
- Installing laravel/framework (v5.5.48): Downloading (100%)
- Installing fideloper/proxy (3.3.4): Downloading (100%)
- Installing jakub-onderka/php-console-color (v0.2): Downloading (100%)
- Installing jakub-onderka/php-console-highlighter (v0.4): Downloading (100%)
- Installing nikic/php-parser (v4.3.0): Downloading (100%)
- Installing dnoegel/php-xdg-base-dir (v0.1.1): Downloading (100%)
- Installing psy/psysh (v0.9.12): Downloading (100%)
- Installing laravel/tinker (v1.0.10): Downloading (100%)
- Installing filp/whoops (2.7.1): Downloading (100%)
- Installing fzaninotto/faker (v1.9.1): Downloading (100%)
- Installing hamcrest/hamcrest-php (v2.0.0): Downloading (100%)
- Installing mockery/mockery (1.3.1): Downloading (100%)
- Installing sebastian/version (2.0.1): Downloading (100%)
- Installing sebastian/resource-operations (1.0.0): Downloading (100%)
- Installing sebastian/recursion-context (3.0.0): Downloading (100%)
- Installing sebastian/object-reflector (1.1.1): Downloading (100%)
- Installing sebastian/object-enumerator (3.0.3): Downloading (100%)
- Installing sebastian/global-state (2.0.0): Downloading (100%)
- Installing sebastian/exporter (3.1.2): Downloading (100%)
- Installing sebastian/environment (3.1.0): Downloading (100%)
- Installing sebastian/diff (2.0.1): Downloading (100%)
- Installing sebastian/comparator (2.1.3): Downloading (100%)
- Installing doctrine/instantiator (1.0.5): Downloading (100%)
- Installing phpunit/php-text-template (1.2.1): Downloading (100%)
- Installing phpunit/phpunit-mock-objects (5.0.10): Downloading (100%)
- Installing phpunit/php-timer (1.0.9): Downloading (100%)
- Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)
- Installing theseer/tokenizer (1.1.3): Downloading (100%)
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)
- Installing phpunit/php-token-stream (2.0.2): Downloading (100%)
- Installing phpunit/php-code-coverage (5.3.2): Downloading (100%)
- Installing webmozart/assert (1.7.0): Downloading (100%)
- Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)
- Installing phpdocumentor/type-resolver (0.5.1): Downloading (100%)
- Installing phpdocumentor/reflection-docblock (4.3.4): Downloading (100%)
- Installing phpspec/prophecy (v1.10.3): Downloading (100%)
- Installing phar-io/version (1.0.1): Downloading (100%)
- Installing phar-io/manifest (1.0.1): Downloading (100%)
- Installing myclabs/deep-copy (1.7.0): Downloading (100%)
- Installing phpunit/phpunit (6.5.14): Downloading (100%)
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/var-dumper suggests installing ext-symfony_debug
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/yaml (For using the YAML loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/routing suggests installing doctrine/annotations (For using the annotation loader)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/dependency-injection
symfony/http-kernel suggests installing symfony/browser-kit
symfony/http-kernel suggests installing symfony/config
symfony/http-kernel suggests installing symfony/dependency-injection
symfony/console suggests installing symfony/lock
egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)
swiftmailer/swiftmailer suggests installing ext-intl (Needed to support internationalized email addresses)
swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)
ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)
ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)
ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)
ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)
ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)
ramsey/uuid suggests installing paragonie/random-lib (Provides RandomLib for use with the RandomLibAdapter)
symfony/translation suggests installing symfony/config
symfony/translation suggests installing symfony/yaml
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)
league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)
league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)
league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)
league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)
league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)
league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)
league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)
league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)
league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)
league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)
laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (~3.0).)
laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (~2.5).)
laravel/framework suggests installing guzzlehttp/guzzle (Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).)
laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (~1.0).)
laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).)
laravel/framework suggests installing league/flysystem-cached-adapter (Required to use Flysystem caching (~1.0).)
laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (~1.0).)
laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).)
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~3.0).)
laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (~3.3).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (~1.0).)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Package mtdowling/cron-expression is abandoned, you should avoid using it. Use dragonmantank/cron-expression instead.
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.
6 packages you are using are looking for funding.
Use the composer fund command to find out more!
> @php artisan key:generate
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
Application key [base64:ZantHwDMMBunsRbtFiJakUJH5PZVqUzgZe2D/tVk/h4=] set successfully.
(base) wdh@wdh:~/D/nmpr/nginx/www/www_test$