Mac下错误问题收集

Mac下错误问题收集

开发环境问题

  • PHP开发环境
20180413
今天在使用电脑的时候莫名其妙的PHP不能用了
PHP是使用brew安装的,索性就重装了PHP

先把PHP和PHP的扩展全部卸载了.然后重新安装.
但是安装之后一直爆出下面的错误.
Warning: Module 'gmp' already loaded in Unknown on line 0
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0

意思是该扩展已被加载,不要再重新加载了
几经排查,找不到问题所在

查看PHP.ini的配置信息
PHP -i | grep php.ini
找到PHP.ini的位置,然后vim进去也没看到加载项.
我们知道,MAC中使用brew安装的PHP扩展是不会在PHP.ini中添加扩展信息的.

而是在PHP.ini同级目录下的ext目录下,每一个扩展
添加一个配置文件, 配置文件中没有别的信息,
只有一条引入该扩展的数据, 如swoole扩展
[swoole]
extension="/usr/local/opt/php70-swoole/swoole.so"

这时候我们把错误提示中,提示重复载入的扩展注释掉.
使用 PHP -v 
发现不再有重复加载的错误提示


具体的排查方式为:
一、查看php.ini文件:

php -i | grep .ini
Loaded Configuration File => /usr/local/etc/php/7.0/php.ini
在配置文件中排查

二、查看php编译的配置

Configure Command =>  './configure'  '--prefix=/usr/local/Cellar/php@7.0/7.0.29_1' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/7.0' '--with-config-file-path=/usr/local/etc/php/7.0' '--with-config-file-scan-dir=/usr/local/etc/php/7.0/conf.d' '--with-pear=/usr/local/Cellar/php@7.0/7.0.29_1/share/php@7.0/pear' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-dtrace' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-apxs2=/usr/local/opt/httpd/bin/apxs' '--with-bz2' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/opt/gmp' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos' '--with-layout=GNU' '--with-ldap' '--with-ldap-sasl' '--with-libedit' '--with-libzip' '--with-mcrypt=/usr/local/opt/mcrypt' '--with-mhash' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-ndbm' '--with-openssl=/usr/local/opt/openssl' '--with-pdo-dblib=/usr/local/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-pdo-pgsql=/usr/local/opt/libpq' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' '--with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp' '--with-xmlrpc' '--with-xsl' '--with-zlib' '--with-curl'

发现,有'--enable-mcrypt'存在,说明使用brew安装扩展的时候,可能重新编译了php


三、查看引入的所有.ini文件
Configuration File (php.ini) Path => /usr/local/etc/php/7.0
Loaded Configuration File => /usr/local/etc/php/7.0/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed => /usr/local/etc/php/7.0/conf.d/ext-gmp.ini,
/usr/local/etc/php/7.0/conf.d/ext-igbinary.ini,
/usr/local/etc/php/7.0/conf.d/ext-imagick.ini,
/usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.0/conf.d/ext-memcached.ini,
/usr/local/etc/php/7.0/conf.d/ext-mongodb.ini,
/usr/local/etc/php/7.0/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.0/conf.d/ext-redis.ini,
/usr/local/etc/php/7.0/conf.d/ext-swoole.ini,
/usr/local/etc/php/7.0/conf.d/ext-uuid.ini,
/usr/local/etc/php/7.0/conf.d/ext-yaf.ini
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
Supported handlers => ndbm cdb cdb_make inifile flatfile
init_command_executed_count => 0
init_command_failed_count => 0
com_init_db => 0
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException
open sourced by => Epinions.com


在这里,找到了这样一条可能重复加载mcrypt的.ini文件

/usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini,

进入该文件发现有该信息,注释掉 之后PHP -v不在爆错
[mcrypt]
extension="/usr/local/opt/php70-mcrypt/mcrypt.so"

MAC应用无法打开或文件损坏的处理方法

在MAC下安装一些软件时提示"来自身份不明开发者",其实这是MAC新系统启用了新的安全机制。

默认只信任 Mac App Store 下载的软件和拥有开发者 ID 签名的应用程序。

会提示: 打不开 xxx,因为它来自身份不明的开发者”。

解决方法有2种:

  • 最简单的方式:按住Control后,再次点击软件图标,即可。
  • 修改系统配置:系统偏好设置... -> 安全性与隐私。

如果没有这个选项的话(macOS Sierra 10.12),打开终端,执行sudo spctl --master-disable即可

转载于:https://my.oschina.net/chinaliuhan/blog/3065343

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值