安装mcrypt在OSX 10.8.2 - PHP 5.3.15与自制

时间:2021-07-09 06:07:07

I've successfully installed mcrypt via homebrew but I'm struggling to find the path to mcrypt.so to include it as an extension in php.ini.

我已经成功地通过homebrew安装了mcrypt,但是我正在努力找到mcrypt的路径。把它作为php。ini的扩展。

mcrypt was installed at /usr/local/Cellar/mcrypt/2.5.8. Tree:

mcrypt安装在/usr/local/ cellar /mcrypt/2.5.8。树:

-- AUTHORS
|-- ChangeLog
|-- INSTALL_RECEIPT.json
|-- NEWS
|-- README
|-- TODO
|-- bin
|   `-- libmcrypt-config
|-- include
|   |-- mcrypt.h
|   `-- mutils
|       `-- mcrypt.h
|-- lib
|   |-- libmcrypt.4.4.8.dylib
|   |-- libmcrypt.4.dylib -> libmcrypt.4.4.8.dylib
|   `-- libmcrypt.dylib -> libmcrypt.4.4.8.dylib
`-- share
    |-- aclocal
    |   `-- libmcrypt.m4
    `-- man
        `-- man3
            `-- mcrypt.3

I tried to include mcrypt.h in php.ini:

我试着加入mcrypt。h在php . ini中:

extension="/usr/local/Cellar/mcrypt/2.5.8/include/mcrypt.h"

and then restarted apache. but it didn't work.

然后重新启动apache。但它不工作。

when I run php in the terminal I get:

在终端运行php时,我得到:

PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/local/Cellar/mcrypt/2.5.8/include/mcrypt.h' - dlopen(/usr/local/Cellar/mcrypt/2.5.8/include/mcrypt.h, 9): 
image not found in Unknown on line 0

6 个解决方案

#1


47  

First check if brew is up-to-date:
brew doctor

首先检查brew是否为最新版本:brew doctor

Second install mcrypt based on php version:
brew install php53-mcrypt

基于php版本安装mcrypt: brew安装php53-mcrypt

NB: Step three below is not required on recent versions of brew:

NB:最新版本的brew不需要以下第三步:

Third open php.ini file and add reference:
sudo vi /private/etc/php.ini
extension="/usr/local/Cellar/php53-mcrypt/5.3.25/mcrypt.so"

第三个打开php。ini文件并添加引用:sudo vi /private/etc/php。ini扩展= " / usr /地方/地窖/ php53-mcrypt / 5.3.25 / mcrypt.so”

Finally, restart apache:
sudo apachectl restart

最后,重新启动apache: sudo apachectl重新启动

#2


22  

After wondering for hours through different advices, this one worked for me (Installed via MacPorts):

在通过不同的建议思考了几个小时之后,这个方法对我起了作用(通过MacPorts安装):

Courtesy of Chris Brewer:

由克里斯·布鲁尔:

Download and install MacPorts from http://macports.org.

从http://macports.org下载并安装MacPorts。

The following steps are performed in the Terminal:

终端执行以下步骤:

Force MacPorts to update (will only work if Apple's Xcode installed):

强制MacPorts进行更新(只在安装了苹果的Xcode后才生效):

sudo port -v selfupdate

Now, install memcached:

现在,安装memcached:

sudo port install php5-mcrypt

Copy the newly created shared object for mcrypt into Mac OS X’s default PHP5 extension directory:

将新创建的mcrypt共享对象复制到Mac OS X的默认PHP5扩展目录中:

sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Next, you need to edit php.ini to add the extensions. Find the phrase Dynamic Extensions, and add:

接下来,需要编辑php。i添加扩展。查找短语动态扩展,并添加:

extension=mcrypt.so

And finally, restart Apache:

最后,重新启动Apache:

sudo apachectl restart

sudo apachectl restart

#3


9  

I've solved the problem with this

我已经解决了这个问题。

brew install php54-mcrypt --without-homebrew-php

Then I add this line to /etc/php.ini.

然后我把这条线加到/etc/php.ini中。

extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"

If this file doesn't exists you'll need to copy it from /etc/php.ini.default. Also I check the version of my php with php -v (And it was 5.4.x)

如果这个文件不存在,您需要从/etc/php.ini.default复制它。我还用php -v检查php版本(它是5.4.x)

#4


0  

I appreciate the work you did on this! This worked for me. I am on a mac and it was looking for xcode. The Developer location hadn't been set so I had to do all of this.

我很感激你在这方面所做的工作!这为我工作。我在用mac电脑,它在找xcode。开发人员的位置还没有设置,所以我必须做所有这些。

(RESOLVE THE DEVELOPER PATH) How can I resolve "Error: No developer directory found at /Developer"?

(解析开发人员路径)如何解决“错误:在/ DEVELOPER中没有找到开发人员目录”?

  1. sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
  2. sudo xcode-select开关/应用程序/ xcode /内容/开发人员

(SIGN THE AGREEMENT TO USE XCODE)

(签署协议使用XCODE)

  1. sudo xcodebuild -license
  2. sudo xcodebuild许可证

Lastly follow the above steps!

最后,遵循以上步骤!

#5


0  

This may prove useful...

这可能是有用的……

  1. brew tap homebrew/homebrew-php
  2. 利用自制程序/ homebrew-php酿酒
  3. brew install php56-mcrypt
  4. 酿造安装php56-mcrypt

#6


0  

Worked like a piece of cake with this.

就像一块蛋糕。

$ brew install mcrypt
Warning: mcrypt-2.6.8 already installed
$ brew install php55-mcrypt
Warning: php55-mcrypt-5.5.20 already installed

Then test it out:

然后对其进行测试:

$ php -m | grep mcrypt
mcrypt

$ php -i | grep mcrypt
Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini,
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

#1


47  

First check if brew is up-to-date:
brew doctor

首先检查brew是否为最新版本:brew doctor

Second install mcrypt based on php version:
brew install php53-mcrypt

基于php版本安装mcrypt: brew安装php53-mcrypt

NB: Step three below is not required on recent versions of brew:

NB:最新版本的brew不需要以下第三步:

Third open php.ini file and add reference:
sudo vi /private/etc/php.ini
extension="/usr/local/Cellar/php53-mcrypt/5.3.25/mcrypt.so"

第三个打开php。ini文件并添加引用:sudo vi /private/etc/php。ini扩展= " / usr /地方/地窖/ php53-mcrypt / 5.3.25 / mcrypt.so”

Finally, restart apache:
sudo apachectl restart

最后,重新启动apache: sudo apachectl重新启动

#2


22  

After wondering for hours through different advices, this one worked for me (Installed via MacPorts):

在通过不同的建议思考了几个小时之后,这个方法对我起了作用(通过MacPorts安装):

Courtesy of Chris Brewer:

由克里斯·布鲁尔:

Download and install MacPorts from http://macports.org.

从http://macports.org下载并安装MacPorts。

The following steps are performed in the Terminal:

终端执行以下步骤:

Force MacPorts to update (will only work if Apple's Xcode installed):

强制MacPorts进行更新(只在安装了苹果的Xcode后才生效):

sudo port -v selfupdate

Now, install memcached:

现在,安装memcached:

sudo port install php5-mcrypt

Copy the newly created shared object for mcrypt into Mac OS X’s default PHP5 extension directory:

将新创建的mcrypt共享对象复制到Mac OS X的默认PHP5扩展目录中:

sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Next, you need to edit php.ini to add the extensions. Find the phrase Dynamic Extensions, and add:

接下来,需要编辑php。i添加扩展。查找短语动态扩展,并添加:

extension=mcrypt.so

And finally, restart Apache:

最后,重新启动Apache:

sudo apachectl restart

sudo apachectl restart

#3


9  

I've solved the problem with this

我已经解决了这个问题。

brew install php54-mcrypt --without-homebrew-php

Then I add this line to /etc/php.ini.

然后我把这条线加到/etc/php.ini中。

extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"

If this file doesn't exists you'll need to copy it from /etc/php.ini.default. Also I check the version of my php with php -v (And it was 5.4.x)

如果这个文件不存在,您需要从/etc/php.ini.default复制它。我还用php -v检查php版本(它是5.4.x)

#4


0  

I appreciate the work you did on this! This worked for me. I am on a mac and it was looking for xcode. The Developer location hadn't been set so I had to do all of this.

我很感激你在这方面所做的工作!这为我工作。我在用mac电脑,它在找xcode。开发人员的位置还没有设置,所以我必须做所有这些。

(RESOLVE THE DEVELOPER PATH) How can I resolve "Error: No developer directory found at /Developer"?

(解析开发人员路径)如何解决“错误:在/ DEVELOPER中没有找到开发人员目录”?

  1. sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
  2. sudo xcode-select开关/应用程序/ xcode /内容/开发人员

(SIGN THE AGREEMENT TO USE XCODE)

(签署协议使用XCODE)

  1. sudo xcodebuild -license
  2. sudo xcodebuild许可证

Lastly follow the above steps!

最后,遵循以上步骤!

#5


0  

This may prove useful...

这可能是有用的……

  1. brew tap homebrew/homebrew-php
  2. 利用自制程序/ homebrew-php酿酒
  3. brew install php56-mcrypt
  4. 酿造安装php56-mcrypt

#6


0  

Worked like a piece of cake with this.

就像一块蛋糕。

$ brew install mcrypt
Warning: mcrypt-2.6.8 already installed
$ brew install php55-mcrypt
Warning: php55-mcrypt-5.5.20 already installed

Then test it out:

然后对其进行测试:

$ php -m | grep mcrypt
mcrypt

$ php -i | grep mcrypt
Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini,
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value