Any help would be great. I've been stuck on this for hours. I'm trying to install Mongo to work with PHP on a Mac. I have Pear/pecl installed and working. When I call sudo pecl install mongo, everything looks like it's compiling/building successfully, but at the end I get this message.
Build process completed successfully Installing
'/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so' ERROR:
failed to write
/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so
(copy(/usr/lib/php/extensions/no-debug-non-zts-20121212/mongo.so):
failed to open stream: Operation not permitted)
And the mongo.so never gets written. Can someone help? I'm using MAMP on Mac OSX El Capitan.
I've solved this problem by changing extension_dir in php.ini.
Create a local extension dir and copy your existing extensions into
mkdir -p /usr/local/lib/php/extensions
cp /usr/lib/php/extensions/no-debug-non-zts-20121212/* /usr/local/lib/php/extensions/
Update your php.ini, change the extension_dir and enable mongo:
extension_dir = "/usr/local/lib/php/extensions/"
extension=mongo.so
Now the extension dir is writeable you can copy the mongo.so there.
Here's how to compile a mongo.so
wget http://pecl.php.net/get/mongo
tar xzvf mongo
cd mongo-1.6.12
phpize
./configure --with-php-config=/usr/bin/php-config --with-mongo-sasl=no
make
You can find the compiled library in .libs folder: .libs/mongo.so
Copy it to extensions dir
cp .libs/mongo.so /usr/local/bin/php/extensions/
Finally, you can check whether it's working or not, by typing php -m | grep mongo in the command line.
Robert has solved this problem in this answer.
stackoverflow.com/a/31884146
.
Basically the issue is the El Capitan's Rootless feature. Its needs to be disabled in recovery mode, perform the pecl install and that enable it back again .
For some reason , pecl did not install it into my php extensions directly so, I had to copy the mongo extension pecl generated from the local library to my php extension folder xampp files for it to work
Related
I tried to install Magento on localhost (XAMPP) for the first time today. As Magento installer does the Readiness Check an error occurs, as it is missing PHP Extension intl. I have done research, but all I can find is to remove ; from ";extension=php_intl.dll" in php.ini in etc folder. This does not work (tried to restart XAMPP and the computer several times)
This is driving me crazy, please help.
I am on macOS Sierra.
First of all, you should check with phpinfo() method to check intl loaded or not. some time may this loaded bud you are in the mistakes.
after that, check php_intl.dll existin this folder : "\xampp\php\ext"
if all of these are ok, you may check log files.
UPDATE:
Base on your update about OS,if you have homebrew available and have PHP7:
$ brew install php70-intl // For PHP7.0
$ brew install php71-intl // For PHP7.1
For PHP5.5:
$ brew install php55-intl
Re-open your terminal window to ensure it works right in your session. To see if it loaded via your CLI interpreter:
$ php -m | grep intl
Or:
$ php -i "(command-line 'phpinfo()')" | grep intl
Source: https://daveismyname.blog/blog/install-php-intl-on-mac-using-homebrew
You need to check your correct php.ini file and also create a php file with a function phpinfo() and run this file and check the extension that are not installed.
To enable/installed these extension go to php.ini file and uncomment those extension.
save this file and restart the apache/xampp
I hope it will work for you.
I am searching the way to debug php scripts. In internet i found information that i can do that with MacGDBp + XDebug.
When i'm trying install using PECL in Shell:
sudo pecl install xdebug
The next error have been occured:
downloading xdebug-2.4.0.tgz ...
Starting to download xdebug-2.4.0.tgz (264,832 bytes)
.....................done: 264,832 bytes
76 source files, building
running: phpize
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:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Help me find the way to solve that problem.
XDebug is available by default. Just enable it by
1) sudo nano /etc/php.ini (or sudo cp /etc/php.ini.default /etc/php.ini first if the file doesn't yet exist)
2) Add these lines at the end (verify the path with ls ls /usr/lib/php/extensions/)
[Xdebug]
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
3) Restart apache using sudo apachectl restart
4) Verify by php -m | grep xdebug
Mike Chamberlain's excellent response almost got xdebug working with NetBeans using Mac OS Sierra 10.12. Only two changes required:
In step 2, after
zend_extension="/usr/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
also add
xdebug.remote_enable=1
This was necessary because the precompiled .so file has xdebug remote access disabled. NetBeans and other tools need it to be enabled.
For debugging using xdebug i used the following steps
For installing php72 I installed using brew with the following command:
brew install homebrew/php/php72-xdebug
I added the following command to the bottom of the php.ini file:
zend_extension=/usr/local/Cellar/php72-xdebug/2.6.0/xdebug.so
Note: if you need to search for a version of xdebug with brew use:
brew search xdebug
here is the output im getting.
showing output after running this command : pecl install apc
downloading APC-3.1.13.tgz ...
Starting to download APC-3.1.13.tgz (171,591 bytes)
.....................................done: 171,591 bytes
could not extract the package.xml file from "/build/buildd/php5-5.5.9+dfsg/pear- build-download/APC-3.1.13.tgz"
Download of "pecl/apc" succeeded, but it is not a valid package archive
Error: cannot download "pecl/APC"
Download failed
install failed.
I have to install apc via cmd.
problem im facing is installation failure.
Try using the default system apc install:
sudo apt-get install php-apc
Here is how I install PHP APC:
Download latest stable Version
PHP APC-3.1.9 (stable) can be found on PECL page. Download and save (to desktop).
Begin installation
Untar APC, move into extracted directory
tar xvzf APC-3.1.9.tgz
cd APC-3.1.9/
Now, we want to phpize current directory. Because I use LAMPP PHP installation, its phpize is located in /opt/lampp/bin. Then, new .configure file will be created (your php-config may differ).
/opt/lampp/bin/phpize
./configure --with-php-config=/opt/lampp/bin/php-config
Then,
make
sudo make install
Configure php.ini file
Next, we want to configure APC for use. Edit your php.ini file. (mine was located in /opt/lampp/etc/php.ini).
vim /opt/lampp/etc/php.ini
Add these lines (preferably under Dynamic Extension section, but you can place it anywhere):
extension=apc.so
apc.enabled=1
apc.shm_size=40M
apc.ttl=7200
apc.user_ttl=7200
apc.enable_cli=1
apc.max_file_size=5M
also edit extension_dir on php.ini file
extension_dir = "/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/"
your extension_dir refers to make install result.
Now, look at phpinfo() page to verify your APC installation.
References:
Install guide
I've been having some trouble getting CURL working with PHP on a server I inherited.
So far I have enabled the extension in my php.ini by uncommenting the extension=php_curl.dll line, and restarting apache.
However, I now receive the following error when starting PHP:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/php_curl.dll
The php_curl.dll file doesn't exist in the aforementioned directory, and I can't find anywhere legitimate to download it from(doesn't seem to be included in PHP, or Curl).
UPDATE
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.
Why don't use
sudo port install php5-curl
(on php54: php54-curl)?
Download the 'port' using the following URL and install it:
http://www.macports.org/install.php
There are different versions and you can select one installation pack for your Mac Version.
After installed, open a terminal and type the following command to install directly,
$ sudo port install php5-curl
Otherwise
- Login to port terminal by just typing
$ sudo port
and type
> install php5-curl
It will get few minutes to install all the dependancies and finally you will see the following message
---> No broken files found.
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.
I'm using XAMPP for Windows and decided to try out Symfony 2.
As soon as I get to Symfony Configuration page it recommends me to install and enable intl.
I tried reading PEAR's and PECL's guides, since I'm total 0 on this topic(started learning PHP recently), but nothing worked.
I found php_intl.dll inside my C:\xamp\php\ext. The php.ini's extension_dir= is set to "C:\xampp\php\ext". I was only missing the extension=php_intl.dll inside php.ini, so I added it.
Unfortunately it didn't work, and Symfony keeps asking me for intl.
Whenever you make changes to php.ini, remember to restart Apache. Otherwise the changes won't take effect. You can do this in the XAMPP Control Panel by clicking the stop/start button in the Apache module row.
http://php.net/manual/en/intl.requirements.php
This extension is bundled with PHP as of PHP version 5.3.0.
Alternatively, the PECL version of this extension may be used with all
PHP versions greater than 5.2.0 (5.2.4+ recommended).
also read my comment to your post above
Follow these steps:
Copy all the file names starting with "icu" from C:\wamp\bin\php\php5.5.12 and paste to C:\wamp\bin\apache\apache2.4.9\bin (I am using WAMP. Figure it out yourself for XAMP.)
You can try. Nothing will harm. If you feel the things are not working, you can delete them. I am sure it will work for you 100%.
Uncomment the following line on C:\wamp\bin\apache\apache2.4.9\bin\php.ini
extension=php_intl.dll
It will work.
For Linux users:
Installing php5-intl made it work for me
sudo apt-get install php5-intl
found here:
http://www.php.net/manual/en/intl.setup.php
For OS X users:
1.Normally, the PHP is automatically installed on OSX. So, if you would like to use the XAMPP, or whatever apache server, you must change the path point to XAMPP. You can check the path by using:
$ which php
(do not copy $ sign, it means than you should type this in Terminal, not php)
You should get: /Applications/XAMPP/xamppfiles/bin/php ,
if not, you will get /usr/bin/php.
This is OSX' php. So, you have to change it to XAMPP' php by using:
$ PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
2.Run this command to download, unpack, compile and install ICU (you can choose different version is your Symfony required):
$ curl -sS -o /tmp/icu.tar.gz -L http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz && tar -zxf /tmp/icu.tar.gz -C /tmp && cd /tmp/icu/source && ./configure --prefix=/usr/local && make && sudo make install
than run:
$ sudo pecl install intl
and specify where ICU libraries and headers can be found [DEFAULT] :
/usr/local
Pay attention to information in install report:
You should add "extension=intl.so" to php.ini
Don't forget to reboot Apache and check version:
<?php
if (extension_loaded('intl')) {
echo "PHP: " . PHP_VERSION . "<br>\n";
echo "ICU: " . INTL_ICU_VERSION . "<br>\n";
} else {
die('OOPS! The intl extension is not enabled!');
}
Partially taken from here but modified to get success Install PHP Internationalization extension (Intl) on XAMPP on Mac
To activate this extension in Xampp, just edit your php.ini (i.e. in C:\xampp\php directory) and remove the semicolon to uncomment this line :
;extension=php_intl.dll
Eventually don’t forget to restart Apache !
To solve this go to "c:\xampp\php\php.ini" open it in your editor and search for Dynamic Extensions then go down search for ;extension=php_intl.dll and enable it(remove ; to became like ) extension=php_intl.dll after that save your file php.ini and restart your localhost