I and working on setting up a LAMP stack on a new Mac Mini to use as a web server. I am using the bundled PHP version 5.3.3 and Apache 2.2.15.
I have gotten phpMyAdmin working and connect to my mysql installation but I get a "Cannot load mcrypt extension. I did this tutorial - http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/ - to get mcrypt installed and phpinfo() shows mcrypt is installed as per the screenshot at the end.
But im still getting the mcrypt extension not loaded warning. How can I get rid of this. This server is eventually going to be used for production and I would like it to be secure.
Replace extension=mcrypt.so from the tutorial with extension=the/full/path/to/mcrypt.so seems to clear it up.
You may have built mcrypt as i386. Check this with the file command (file mcrypt.so).
Your new Mac mini is 64-bit. Try building mcrypt as x86_64. You could try hacking the Makefile or setting ARCHFLAGS="-arch x86_64".
Related
I have a variant of this question.
Everything was working fine on my development machine (Mac) but I had to reinstall php with homebrew because I needed the '--with-homebrew-curl' option. PHP got updated from 5.6.18 to 5.6.30. Now the old mysql functions like mysql_connect() aren't working any more, alas they are gone like as if I was using PHP 7, which I'm not.
I have looked at phpinfo and see that under 'mysqlnd'->'API Extensions' it says only 'pdo_mysql,mysqli'. On my production server (where php hasn't been installed with homebrew) it says 'mysql,mysqli,pdo_mysql' and there is an own mysql section.
What has happened to the mysql-support in mysqlnd on my development machine? Can it be because it php went from 5.6.18 to 5.6.30? Can I force homebrew to install 5.6.18? Is it possible to "unlock" mysql in mysqlnd?
Yes, I had added extension=mysql.so in my php.ini, but it turned out that the mysql.so file was not in my extension folder nor anywhere else on my machine. Solved this by downloading the php source and building the extension manually and then copying it into the extension folder.
I have also added this answer to the one #cale_b found so that this one could be closed.
When running a php command in terminal I keep getting "Mcrypt PHP extension required." I have installed Mcrypt using the instructions here and phpinfo does show that it is enabled (Version: 2.5.8, Api No: 20021217). How can I get this to work to stop PHP from erroring?
Judging by the linked instructions, you've probably enabled the extension only for the SAPI used by Apache.
There's usually a separate config file (/etc/php-cli.ini or something like that), which also has to be modified for CLI to load the extension.
I have been trying to install memcached on an ubuntu server and I followed a lot of tutorials over the internet. I am using 32-bit ubuntu 12.04, php version 5.4.7, xampp server 1.8.1 which are all 32-bit versions. In the end, I followed the tutorial in the below link and I installed all the things listed with no error.
http://stevelove.org/2009/09/30/how-to-install-php-memcached-on-an-ubuntu-server/
The only problem I have is that when I installed memcached using "sudo pecl install memcached" command, the extension couldn't be added to php.ini file. Then I used phpinfo() to learn which php.ini file I am using and added extension=memcached.so to the ini file. When I restarted xampp server, php.ini file doesn't work and it tries to download the pages. In the php error log, I get this error.
[30-May-2013 16:42:48 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/memcache.so' - /opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/memcache.so: cannot open shared object file: No such file or directory in Unknown on line 0
Since I couldn't enable the extension, even though memcached is listed as installed with php -m command, I get Class memcached not found error when I try to execute my php code.
Can someone please help me with this issue?
Maybe because you installed the server but not the extension, try
sudo apt-get install php5-memcached
ps: memcache != memcached
Firstly, thank you for your answer Mohammad. I know that memcache is not memcached and as I said, when I list modules, memcached seems installed (not memcache) but when I use phpinfo(), memcached is not listed.
It turns out that even though I installed memcached, problem was xampp installation. I removed lampp and php5 installed in ubuntu and purged everything I installed. Then I installed xampp with development packages and re-installed libmemcached etc. It works fine now.
If there is anybody having similar problem, I can explain in detail.
I know you cannot install the MongoDB server on a PowerPC Mac, but I can't find any instructions on installing JUST the PHP driver to XAMPP.
Does anyone know if this is possible. If so, how do you do it? I've done extensive searching and can't find an answer to this.
I dusted off a G4 Powerbook with OS X 10.5.8 to test. Turns out that the current precompiled version of mongo.so for PHP 5.3 on github doesn't support PowerPC (the PHP 5.2 build appears to).
I downloaded the PHP 5.3.1 source to match XAMPP 1.7.3 and compiled my own mongo.so (1.2.12).
I did some minimal testing with XAMPP 1.7.3 on PowerPC to confirm this appears to work. Essentially, I just pasted the example from the MongoDB PHP Driver Tutorial, and inserted some documents into MongoDB 2.0.6 running on another computer.
Note this is an unofficial & unsupported mongo.so build, the same as what you should get building successfully from source with pecl install mongo. As a bonus, this is a much newer driver version than the precompiled OS X ones currently on github.
As a warning: I'm not sure about limitations or quirks of using this on PowerPC. Most of the OS X world has moved on to Intel architecture now.
So, instructions to use:
Download and install XAMPP Mac OS X 1.7.3 universal binary.
Download mongo-ppc-1.2.12.so from my github: mongodb-php-driver/downloads
Rename that to mongo.so and copy into /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/
Edit XAMPP/etc/php.ini and add a last line with:
extension=mongo.so
Check via phpinfo() that the mongo extension is available. Make sure you stop/start Apache if it was already running when you added the extension.
I'm trying to get the latest Mongo Driver to work with MAMP 1.9.6 on OS X 10.5.8.
I built it successfully from source since it seems that there are no pre-compiled releases, included it into the right directory and restarted the apache.
But PHP doesn't recognize the extension. I used the 1.0.11 driver previously which worked fine, but I need the new version, because Doctrines ODM requires it.
When I replace the 1.2.10 mongo.so with the 1.0.11 and restart apache mongo is available. I don't get what could be wrong.
Anyone had this behaviour or any guesses to get this to work?
Update: The PHP error log shows the following:
[01-Jun-2012 22:02:37] PHP Warning: PHP Startup: mongo: Unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20090626
These options need to match
in Unknown on line 0
I'm not quite sure what it means?
2. Update:
I was finally able to sync the API version of phpize.
But now I'm not able to build the driver anymore.
I do the following:
phpize
./configure
make
sudo make install
But at the make command I'm getting tons of syntax errors. Seems that it can't find several header files.
The very first one is the zend_config.h and really I just have those other two files:
zend_config.nw.h
zend_config.w32.h
I downloaded the MAMP components to get this files. Why am I missing this one? And there are a lot of others.
I'm using PHP 5.3.5 Is there a way to get those header files from a different source?
I followed the instructions at Develop MongoDB web apps with MAMP under Mac OS X to successfully build mongo.so for MAMP with php 5.3 on OS X 10.7.3.
I'm adding this for historical purposes -- I guarantee that if you're having the same set of problems, you'll want to do this.
Personally, I had a really difficult time getting MAMP's php version to play nicely with the extension builds that I was trying to make.
I discovered that the problem was that MAMP really hadn't been set up to add extensions in general, and during the compilation of the mongo php drivers, it wasn't installing it in the right place -- so I followed the following tutorial on preparing MAMP for additional pecl and pear extensions.
After following those steps to prepare MAMP for adding extensions, you can easily install any extension.
At the part where it starts talking about adding an extension, use sudo pecl install mongo and restart apache from your MAMP interface.
I ran into the same problem when upgrading from PHP 5.3 to 5.4 and was able to solve it by following these steps:
Make sure to upgrade php5-cli as well as just php5 and php5-common
Uninstall the mongo drive
sudo pecl uninstall mongo
Re-install the mongo driver
sudo pecl install mongo