So I'm running MAMP on Mountain Lion and I've installed gmagick and imagick using pecl, both are relase candidates (mainly because gmagick doesn't have a stable release and imagick 3.0.0 doesn't install, it gives a make error). The modules appear when I run php -i in the terminal but not in phpinfo(), I have checked the php.ini it is the same for both so that is not the issue.However I have installed bitset(which is a stable release) and it appears in phpinfo() and php -i. So my question is does PHP have any configuration option that does not load extensions if they are not stable? Btw, I did restart my server after the changes to the ini file.
You will probably now have two php installations on your machine. Mountain Lion ships with a preinstalled php version. Trylocate php.ini in Terminal to find out how many php.inis are installed.
In your phpinfo() page there is also noted which php.ini is in use. You might want to open the exact php.ini which is used for your phpinfo() and make sure the extentions are loaded.
There should be two lines like
extension=/path/to/gemagicext/gmagic.so
extension=/path/to/imagick/imagick.so
I faced a similar problem with php-fpm and nginx server. The problem was due to the fact that the updated php configuration was not reflected in the current active php-fpm worker processes. I have to manually kill the fpm process and restart it again to have the updated extensions info.
Steps that worked for me:
1) Look for active php-fpm process
ps ax | grep "fpm"
mostly this will list more than one process
2) kill process manually
kill -9 [pid_got_from_previous_command]
3) restart php-fpm process
sudo service php5-fpm start
Note: Trying something like sudo service php-fpm reload or sudo service php-fpm restart didn't work since the old child processes retained the old configuration. Killing the active processes and restarting php fpm what updated the phpinfo for me.
I had the same problem CentOS 6.6 x64, php 5.5.27 and I followed the steps from
http://php.net/manual/en/imagick.installation.php
First of all download a tar image of the ImageMagick install from here:
sourceforge.net/projects/imagemagick/files/
Unpack it and then from terminal issue the following commands:
1. "cd ImageMagick-6.9.1-10" - go where you placed the folder
2. ./configure
3. make
4. make install
5. make check
6. install imagick extension from pecl.php.net/package/imagick/download 3.1.2
7. cd imagick-3.1.2
8. phpize
9. ./configure --with-imagick=/opt/local
10. make
11. make install
12. Copy imagick.so in your PHP extensions folder and add extension=imagick.so in php.ini
Restart apache: service httpd restart
I am sure this problem is related to your extension and PHP server compatibility. I encountered such problems when I created my own extensions. Your extension should compatible with your PHP server in three main attributes:
1- The Zend API number which your PHP server is configured with ( in phpinfo() you can find this number), this number should be the same with your extension header file at build time.
2- The compiler version on your PHP server and your extension must be the same.
3- Thread safety in your PHP server is important. If you use thread-safe server then your extension must be built with php thread-safe library and if you use non-thread safe server you should build your extension with PHP-nts library.
Related
I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.
I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.
However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.
However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.
In terminal if I type which php & php -v, It shows the correct new version is being used.
But the phpinfo() shows
Did you follow all the instructions provided in the Caveats?
Run brew info php54 to see them again.
Especially the line:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so
Apache is not aware of the homebrew version of PHP (i.e. /usr/bin/php). You see it on the command line because you've likely modified your PATH (i.e. /usr/local/bin/php).
You can modify this in your httpd.conf file.
I am not a fan of homebrew or other package libraries. Primarily because Mac OS X is built atop Unix. Furthermore, all but MySQL are installed natively. Here's an article on installing Apache, MySQL, and PHP on Mac OS X.
Disclaimer: I wrote that article.
Today I have same issue for updating php 7.2 to 7.3 as requirement of Laravel 6. Here is my solution.
Open your httpd.conf file in "/etc/apache2/http.conf"
Search (Ctrl + w) for "LoadModule php"
Uncomment that row
Restart your apache with "sudo apachectl restart"
Then, your php version in local web server (apache2) will be updated
So macOS High Sierra 10.13 now comes with PHP 7.1. While configuring Apache I also created a new /etc/php.ini from the /etc/php.ini.default file, made sure to check that is was being loaded by PHP after restarting Apache, however the version of Xdebug extension that ships with macOS 10.13 doesn't seem to load or show up when you run phpinfo();
My php.ini is definitely being loaded:
$ php -i | grep php.ini
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Here's what my /etc/php.ini looks like where I configure Xdebug:
[xdebug]
zend_extension = "/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so"
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
[Update, fixed that typo here...]
However, Xdebug doesn't load and checking php -i give no results:
$php -i | grep xdebug
PHP Warning: Method xdebug_start_function_monitor() cannot be a NULL
function in Unknown on line 0
PHP Warning: xdebug: Unable to register functions, unable to load in Unknown on line 0
Segmentation fault: 11
And yes, the path to the file is correct:
$ ls /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so*
This used to work on PHP 5 so I hope someone can help me and anyone else in future struggling with this issue.
When I check my apache log I get the following error:
Failed loading /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so: dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so, 9): Symbol not found: _xdebug_monitored_function_dtor
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
Expected in: flat namespace
in /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
I'm not making progress in terms of find out how I can resolve this error:
Symbol not found: _xdebug_monitored_function_dtor
Ok so I finally got it running myself it works perfectly! I'm assuming that the xdebug binary that comes with macOS High Sierra (found under: /usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so) is not compatible with PHP7's new Zend engine.
So I downloaded the latest source from the xdebug website and did the following:
Installed autoconf with brew;
Run phpize to configure the build for the new Zend engine;
Run ./configure
Run make
Now the new binary is under modules/xdebug.so
However macOS System Integrity Protection (SIP) will prevent you from overwriting the xdebug.so under /usr/lib/php/extensions/. I didn't want to disable this so I created a new directory path under /usr/local/lib/php/extensions/ and copied the new binary to this location. I'm not sure if this directory is the best place to put it or if this is bad practice but it worked for me.
Finally I reconfigured my php.ini to use the new binary and everything worked perfectly!
In order to install it you have to have xcode command line tools.
So you need to run:
xcode-select --install
Then you need to install autoconf:
brew install autoconf
Then you have to download the code from here.
After that you have to run in the folder of the source code:
phpize
./configure
make
sudo cp modules/xdebug.so /usr/local/php/extensions (if the directory doesn't exist go and create it)
And finally inside php.ini add
zend_extension=/usr/local/php/extensions/xdebug.so
After that you can enable xdebug inside php.ini and restart apache
sudo apachectl restart
you made a typo in "zend_extention". this should be zend_extension.
and i think the full path is unnecessary
zend_extension=xdebug.so
should be enough
If you have brew installed with multiple PHP versions i.e. 7.1, 7.2 and 7.3 on Mac OS X mojave, you can to do the following:
Install autoconf with brew brew install autoconf.
Change to the PHP version that you want Xdebug on, run brew unlink php#7.1 && brew link --force --overwrite php. This will switch from PHP 7.1 to PHP 7.3.
Download the latest Xdebug source from xdebug website.
Extract the Xdebug tar and navigate to extracted directory, where you'd see all the files.
Run phpize to configure the build for the new Zend engine.
Run ./configure.
Run make.
Xdebug extension xdebug.so gets compiled in modules directory.
Create a new directory path under /usr/local/lib/php/7.3.1/extensions/ and copy xdebug.so to this location. Here, 7.3.1 is the current version that I switched earlier, change this to match your PHP version.
Open php.ini in an editor and enter
zend_extension="/usr/local/lib/php/7.3.1/extensions/xdebug.so" then save the change.
Run php -v and it will show Xdebug has been configured correctly.
If you want to configure Xdebug on another PHP version then just repeat from step 2 all the way to 11. As mentioned in earlier post, this way you don't need to disable/enable System Integrity Protection on Mac OS X.
For anyone arriving late at this party, the initial attempt in the question seems to work just fine in macOS 10.13.6
Hello for everyone that got error trying to install xDebug on Mac.
error: unknown type name 'uint64_t'
There are files in your local/bin/include that causes this error. By removing them you get rid of the error. Though, you might have to reinsatall brew.
https://github.com/cython/cython/issues/2009
I am trying to enable XSL on Ubuntu 12.04 but its failing. I did this locally on my Ubuntu 13.04 and it was successful. Basically the following worked on my local computer.
apt-get install php5_xsl
edit php.ini file and add extension=php5_xsl.so
restart apache
I repeated the same procedures on my production server running Ubuntu 12.04 and PHP version 5.5.12 but the extension is not getting loaded from the phpinfo. I have also changed the extension=php5_xsl.so to extension=xsl.so because this is what in the extension directory.
I read that I might need to recompile PHP but I am not sure of this steps.
Try this:
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Why:
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
What's happened here is that all debian-flavoured unixes have adopted
this standard for their PHP 5.4 packages, so if you're using debian,
ubuntu, or any of their relatives with PHP 5.4, you'll see a directory
structure like this. When you add a module to PHP, you'll add a file
to the mods-available directory enabling the module and adding any
config specific to it. If you want to enable the module, just do:
php5enmod http
This simply creates a symlink from the usual conf.d directory to point
to where the real files are in mods-available, prefixed with a number
that indicates the priority of the module. By default, the priority is
20.
Using this approach means we can toggle things on and off without
commenting out big chunks of config files and leaving them lying
around - if this seems familiar then that's no surprise; debian-like
linuxes manage their apache configuration in just the same way. Any
packages that you install using aptitude will use these exact same
commands to set up the configuration and then symlink it correctly. To
unlink, use the delightfully predictably-named php5dismod :)
I am using MAMP and would like to use mongo with PHP. I am stuck because the version of MAMP I'm using is the latest version I can find, and it's running PHP 5.2.11. The only Mongo PHP install I can find for OSX is for PHP 5.3.
Is there any way to get mongo working with PHP using MAMP?
For MAMP 2.1.2 and PHP 5.4.10
Download MongoDB php driver .
copy mongo.so to
/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/
and using temrinal
cd /Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/ && wget https://github.com/downloads/stennie/mongo-php-driver/mongo.so
open
/Applications/MAMP/bin/php/php5.4.10/conf/php.ini
Find ; Extensions
add
extension=mongo.so
Restart MAMP.
Above steps will install MongoDB driver 1.2.10.
To install latest Mongodb driver using PECL
install autoconf using homebrew or Mac Ports
brew install autoconf
Download php 5.4.10 source from php.net.
rename uncompressed php source folder from php-5.4.10 to php and paste it in this folder
/Applications/MAMP/bin/php/php5.4.10/include/
using the terminal open php folder and run ./configure
cd /Applications/MAMP/bin/php/php5.4.10/include/php/ && ./configure
Add MAMP bin to your ~/.bash_profile
echo "export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
install latest mongo
pecl install mongo
restart MAMP server :).
Here's a tutorial how to do it: http://www.davidgolding.net/mongodb/installing-mongodb-on-mamp-1-9-5.html
Post was removed so here's the tutorial:
Appsolute launched MAMP version 1.9.5 today, so I thought it’d be a great time to add MongoDB to it and improve my NoSQL skills.
Prepare MAMP for MongoDB files
Create a new folder at Applications/MAMP/db/mongo with three additional subfolders named bin, data, and tmp. Provide these folders with chmod 0755 access permissions. These folders will be the main runtime location for Mongo once MAMP gets it running.
Download MongoDB
Grab the latest Mac OS install package of MongoDB. My server setup called for OS X 64-bit, version 1.6.5. It’ll have a directory named bin. Drop the files from this folder into the /Applications/MAMP/db/mongo/bin folder you already created.
Download Mongo Driver for PHP
I’m running PHP 5.3 (why use MongoDB with any earlier version of PHP?), so I’ll need the mongo.so extension to get PHP and Mongo working together. This is available at the MongoDB GitHub repository, under the PHP 5.3 for Mac binary. After unpacking the downloaded file, place the mongo.so extension file in the /Applications/MAMP/bin/php5.3/lib/php/extensions folder.
Update: An alternative is to place the mongo.so file in the /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626 folder and avoid having to edit the php.ini file. It appears that MAMP 1.9.5 already has the extension=mongo.so line in the extensions block of the php.ini file, even though version 1.9.5 doesn’t come bundled with Mongo.
4. Create Startup Routines for MAMP
Lastly, you’ll need to create the startup routines so that MAMP will launch Mongo along with MySQL and Apache. Create a new file at /Applications/MAMP/bin/startMongo.sh and place in it the following code:
# /bin/sh
/Applications/MAMP/db/mongo/bin/mongod --dbpath /Applications/MAMP/db/mongo/data --logpath /Applications/MAMP/db/mongo/mongodb.log --pidfilepath /Applications/MAMP/db/mongo/tmp/mongo.pid --fork --logappend
When called, this script will launch Mongo using the MAMP-relative paths rather than Mongo’s system defaults.
Create another file at /Applications/MAMP/bin/stopMongo.sh and place the shutdown method:
# /bin/sh
/bin/kill `cat /Applications/MAMP/db/mongo/tmp/mongo.pid`
This works like the previous script, except it kills the mongo.pid process, effectively shutting down Mongo.
To have MAMP automatically call these Mongo startup scripts, open the /Applications/MAMP/bin/start.sh and /Applications/MAMP/bin/stop.sh files, and insert the following lines above the startMysql.sh lines, respectively:
1
/Applications/MAMP/bin/startMongo.sh
1
/Applications/MAMP/bin/stopMongo.sh
Now MAMP will automatically launch Mongo upon startup.
The only thing left to do is tell PHP to run the mongo.so extension. If you’re running MAMP Pro, edit the php.ini file by selecting File > Edit Template > PHP 5.3 php.ini, otherwise you’ll need to lookup the path the php.ini file from the MAMP startup screen, under “phpInfo” and “Loaded Configuration File.”
Insert the following line in the php.ini file/template, save the file, then restart MAMP.
1
extension="/Applications/MAMP/bin/php5.3/lib/php/extensions/mongo.so"
Mongo should now run in the background on MAMP, which you can connect with from PHP using the main connection routines listed on the PHP site. Welcome to NoSQL on MAMP!
MAMP is now at version 2.2, which comes with PHP v 5.5.3. I managed to get Mongodb working had to jump through a few hoops to get there.
Start with a clean install of MAMP 2.2, make sure that's working.
1. I made this the system version of PHP, (not sure if necessary at this stage).
Find out the default version of php you are using, with the terminal command
$ which php
/usr/bin/php
Then back this up
$ sudo mv /usr/bin/php /usr/bin/php.bak
Then create a symlink to the MAMP latest version of php
$ sudo ln -s /Applications/MAMP/bin/php/php5.5.3/bin/php /usr/bin/php
Check this has been updated
$ which php
/Applications/MAMP/bin/php/php5.5.3/bin/php
2. Installing Mongo
$ cd /Applications/MAMP/db
$ curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz > mongodb.tgz
$ tar -zxvf mongodb.tgz
$ rm mongodb.tgz
$ mv mongodb* mongo
$ mkdir mongo/data/db
Test to make sure mongo is working
$ ./mongo/bin/mongod --dbpath /Applications/MAMP/db/mongo/data/db
Should output some code, ending in 'waiting for connections on port 27017' press Ctrl + C to quit for now.
3. Now we can create a script to start/stop mongod automatically from the MAMP GUI. This inspiration came from a previous answer, by Alexandru Rada, but didn't quite work how he explained - I think this is to do with being a newer MAMP version.
In /Applications/MAMP/bin create a file called startMongo.sh and insert the following
# /bin/sh
/Applications/MAMP/db/mongo/bin/mongod --dbpath /Applications/MAMP/db/mongo/data/db --logpath /Applications/MAMP/logs/mongodb.log --pidfilepath /Applications/MAMP/tmp/mongo/mongo.pid --fork --logappend
I also created the mongo tmp folder at /Applications/MAMP/tmp/mongo
In the same bin directory create a file called stopMongo.sh and insert the following:
# /bin/sh
/bin/kill `cat /Applications/MAMP/tmp/mongo/mongo.pid`
Make these files executable
$ chmod 775 /Applications/MAMP/bin/startMongo.sh /Applications/MAMP/bin/stopMongo.sh
Now update the startApache.sh and stopApache.sh scripts to include our new files respectively.
Use the Activity Monitor in /Applications/Utilities and search for mongod. When you now start MAMP you should see the process mongod is started. When you stop or quit MAMP you should see this process is automatically killed.
4. We still need to install the mongo-php driver, which is also a pain. To do this I added the MAMP bin directory to my bash $PATH variable. To do this I had to edit the hidden file ~/.profile - but be aware that your $PATH might be loaded from somewhere else.
export PATH=$PATH:/Applications/MAMP/bin/php/php5.5.3/bin:/Applications/MAMP/db/mongo/bin
Note that each element is separated by a :. Quit terminal and re-open, then $ echo $PATH to check your new directories have been added to the path. You could also try $ which pecl or $ which mongod.
We still need some extras from PHP php.net download the same php stable version and unzip it. Create the folder 'include' at /Applications/MAMP/bin/php/php5.5.3/include . Drag the unzipped stable version of php to the include folder, and rename it to just 'php'.
$ cd /Applications/MAMP/bin/php/php5.5.3/include/php
$ ./configure
Now at last, we can hopefully run
$ sudo pecl install mongo
5. Now we just need to update our php config file to add the mongo.so extension.
Open /Applications/MAMP/bin/php/php5.5.3/conf/php.ini in a text editor, under the 'extensions' section, add in
extension=mongo.so
Quit and re-open MAMP!
Mac OS X 10.6 Snow Leopard (with the newest updates) has PHP 5.3 installed along with Apache.
You can enable the installed Apache in System Preferences, Sharing, Web Sharing (there is a help icon (?) which shows you details on using the system's web server).
See also this StackOverflow question:
Easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)?
Here's the way I did it and it was fairly simple.
First, read what Mongo says # http://www.mongodb.org/display/DOCS/PHP+Language+Center
When you run sudo pecl install mongo it's going to install it for the standard OSX PHP installation to use, so if for some reason you're using the built-in Apache installation.
Like you, I like using MAMP. I didn't want to go through figuring how to download Mongo into MAMP, so I just creating a symbolic link in the MAMP PHP Extensions folder and put the extension line in the MAMP php.ini. Restarted MAMP Apache and everything worked beautifully!
A couple things to note, after installing Mongo, note the extensions folder it installed it into then check MAMP php.ini to see where it has its extensions set to be. You'll notice the ending is very similar.
For MAMP PRO 2.0.5
You may compile your own mongo.so (http://m-schmidt.eu/2011/11/06/develop-mongodb-web-apps-with-mamp-under-mac-os-x/) or download compiled (http://www.davidgolding.net/mongodb/installing-mongodb-on-mamp-1-9-5.html).
I'd like compile.
After steps mongo.so don't include to php configuration, because in MAMP PRO php.ini placed in
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources
I using php5.3.6.ini file for my configuration.
I'm trying to install zend debugger in my Ubuntu 9.04 machine, I've done it in win. but not in linux, I hope you could help me, this is what I've done:
1)Copied the file ZendDebugger.so to /etc/php5/apache2 (didn't choose this folder for anything in special).
2)Added this lines to php.ini:
zend_extension="/etc/php5/apache2/ZendDebugger.so" zend_debugger.allow_hosts=127.0.0.1,127.0.1.1,localhost,*
zend_debugger.expose_remotely=always
I've also tried without quotes(zend_extension=/etc/php5/apache2/ZendDebugger.so)
3)Copied file dummy.php to /var/www
And then restarted Apache but I didn't see the information about Zend Debugger in the phpinfo(), the only related thing I found there was report_zend_debug On.
Thanks in advance
I found much more easy to install Xdebug in my Ubuntu machine.
sudo mv /etc/php5/apache2/ZendDebugger.so /usr/lib/php5/20060613/ZendDebugger.so
This is where your memcache.so, apc.so, etc. are located. Unless you modified your php extensions directory that is where new exts should go.
In php.ini:
zend_extension=/usr/lib/php5/20060613/ZendDebugger.so
cd to that directory and chmod a-x ZendDebugger.so to remove executable bits from the .so.
sudo /etc/init.d/apache2 stop
In another terminal window, tail -f /var/log/error.log and clear console so it is easy to see new log entries coming in (cmd-k on macos).
Then:
sudo /etc/init.d/apache2 start
If there are no errors in error.log, check phpinfo() and see if the debugger section shows up.
You might get errors in the configuration of other php extensions that occur further up in php.ini (e.g., xcache or eaccellerator) that will make loading stuff further down in php.ini problematic.
This is a baseline setup and should work if there are no other problems.
You can also try to install Zend Server Community Edition
You'll get Zend Debugger enabled by default, along with some other nice features. There is a link to the deb repository available through the download page.
I followed the same steps that you did with the same result. In the end the problem was that I was trying to load a 32bit binary with apache running in 64bit mode base (as described in this post) I was able to get it running immediately by doing the following.
stopping apache
executing sudo arch -i386 /usr/sbin/httpd
restarting apache.
After replacing the 32bit binary with the 64bit binary everything worked as expected with no special apache handling. There was also some facepalming involved, but it did not affect the overall outcome.