编译安装PHP参考文档:
- https://blog.csdn.net/zrainload/article/details/78812003#cpp
- https://blog.csdn.net/warthur/article/details/51174939
- https://pengxb.com/article/63
上面文档对安装步骤说得很明白了,
若果在编译安装启用fileinfo
内存必须要大于1G,PHP是默认安装。由于我在编译时禁用了 --disable-fileinfo
但在项目又要是用,所有直接当着模块安装,不用重新编译安装整个PHP。
如果在添加fileinfo
出现 internal compiler error: Killed (program cc1plus)
错误,是由于内存不足导致,临时使用交换分区来解决吧。
sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile
#编译完后释放临时空间
Code:
sudo swapoff /swapfile
sudo rm /swapfile
在安装项目是 出现
[root@iZwz99qnmldt4n744noo9gZ biyesheji]# composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
....
通过google 找到了官网 :https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md
也就是说 在执行exec, install, and update
是允许第三方库在你的系统里面执行,执行的都是第三方库里"plugins" and "scripts"
,Plugins and scripts
就会有对应的用户权限去执行composer,为了安全起见避免使用超级用户 或 root
权限。
官方给出了如下解决方案(添加 如下参数第三方 脚本和插件就不会允许)
composer install --no-plugins --no-scripts ...
composer update --no-plugins --no-scripts ...