compiling mcrypt with Yosemite

1

I am following this tutorial: http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

So far it's been great. I have just got to the heading: Compile mcrypt php Extension

When I run /usr/bin/phpize

I get this output:

grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:

I am using PHP 5.5.14 and downloaded the equivalent PHP language in the tutorial. How would I fix this?

Jonnny

Posted 2014-10-19T00:25:42.963

Reputation: 155

I would like to add, that I recently started using Homebrew and it was so much easier and saved me hours to get up and running. I hope this is useful to those who don't want to use Homebrew. But also informative for those who don't know about Homebrew yet or aren't sure whether to use it. – Jonnny – 2015-01-15T17:42:19.437

Answers

2

After a bit of a rathole with this answer originally, revealed in comments it becomes apparent you have executed /usr/bin/phpsize instead of your PHP 5.5.14 version of phpize which supplies configuration files for compiling, in this case mcrypt.

Instead of executing /usr/bin/phpize following the tutorial script you should have invoked your 5.5.14 phpize in the mcrypt directory (see the tutorial Compile mcrypt php Extension).

The idea is that the include tree for matching the PHP version reflected in `/usr/bin/phpize is not installed, it's dependent on having the command line developer tools installed. The presence of the installed version of PHP's include tree doesn't appear to be necessary if you're actually using a different version of PHP, which will have been installed (somewhere) with the required include files.

Use of the correct phpize should straighten out the mcrypt build. If you check the man page you could first execute phpize --clean to remove any incorrect setup first.

You could also note that the developer command line tools are necessary to build mcrypt whose source is written in C. This does not imply or require the use of Xcode.

user187561

Posted 2014-10-19T00:25:42.963

Reputation: 633

thanks David. Does that mean taking the link I was using and rather than using terminal. Use the Xcode console? I don't have much experience with macs. – Jonnny – 2014-10-19T06:49:30.700

Hi David, Sorry, I'm still a little confused as to how to fix this. I have the developer tools and xcode. Which files am I looking for in the xcode contents package I assume? – Jonnny – 2014-10-19T14:38:52.630

Ok, I think I may have found out my problem here, does this seem plausible. I had the new Xcode + developer tools on Maericks and I had set my system PATH to use a newer PHP version, not the one that was with Mavericks. So my include folder is actually in my other PHP 5.5.11 folder. When I got Yosemite I already had XCode + Dev Tools and at the time of download still had the older 5.5.11 PATH. so new PHP 5.5.14 my/usr/bin/php has no include folder. Can I just copy the contents from the other PHP include folder across or should I uninstall Xcode and reinstall? – Jonnny – 2014-10-19T20:57:19.693

Thanks for your help. In the end I copied the include file over and managed to compile. Appreciate your time – Jonnny – 2014-10-20T02:09:54.033

2

Just add symbolic link for php headers directory:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/php /usr/include/php

and then run phpize.

Mirko

Posted 2014-10-19T00:25:42.963

Reputation: 121

It worked for me with El Capitan as well. I just needed to change ../MacOSX10.11.sdk/.. – shinokada – 2015-12-27T02:54:11.267

This will not work for MacOs Catalina. – Khoa TruongDinh – 2019-11-08T09:28:09.540

1

Yes I had to do this first:

cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10sdk/usr/include/php /usr/include/php

Ryan Marshall

Posted 2014-10-19T00:25:42.963

Reputation: 11

0

I encountered the same phpize problem when following the same tutorial. What I did is install the Xcode command line tools, rather than "Get" Xcode after running "xcode-select --install".

Joseph Hui

Posted 2014-10-19T00:25:42.963

Reputation: 101