Mamp environment use PECL to install PHP extension steps

Source: Internet
Author: User
Tags install php php file php source code

1. Download package

Http://pan.baidu.com/s/1dEmIwY9

2. Installation software

3. Activate with serial number in Mamp_pro_3.0.7.3_sn.txt


The above way to build PHP has drawbacks, because the default without PHP source code, so the use of PECL installation expansion will be an error, the following we have to look again

Open the terminal, enter

sudo pecl install MONGO

When it is run, it will look like "Php.h not found" error, because mamp default is not with the PHP source package.

Follow these steps to integrate the source pack to facilitate installation of extensions:

1. Add the index.php file under the Web directory, which reads as follows

<?php
Phpinfo ();

2. Open the browser to access the php file, record PHP version, this article tentatively PHP version a

3. Open the terminal and enter the following command

Php-v

Log PHP version, this article tentatively PHP version B

4. If PHP version A is not equal to PHP version B, execute the following command at the terminal

sudo rm-rf/usr/bin/php
sudo rm-rf/usr/bin/phpize
sudo rm-rf/usr/bin/php-config
sudo rm-rf/usr/bin/pecl

Ln-s/application/mamp/bin/php/php[php version a]/bin/php/usr/bin/php
Ln-s/application/mamp/bin/php/php[php version A]/bin/php-config/usr/bin/php-config
Ln-s/application/mamp/bin/php/php[php version A]/bin/phpize/usr/bin/phpize
Ln-s/application/mamp/bin/php/php[php version A]/bin/pecl/usr/bin/pecl
Please replace [PHP version A] as the version in step 2, such as 5.5.18

command-line mode and browser-mode PHP are consistent after the above command has been executed.

5. Download the PHP source package, open the browser to access the following URL http://cn2.php.net/get/php-[php version
A].tar.gz/from/this/mirror

6. Extract the downloaded compressed package into the/application/mamp/bin/php/php[php version a]/include/php

7. Execute the following command at the terminal

cd/application/mamp/bin/php/php[php version a]/include/php
./configure
At this time the PHP source package has been configured properly, the header file can also be called normally.

8. In the terminal implementation

sudo pecl install MONGO
After the extended installation succeeds, edit the/application/mamp/bin/php/php[php version A]/conf/php.ini add the extension=mongo.so at the end

9. Because the php.ini that are loaded in the command-line mode and in browser mode are not the same file, they need to be handled in a soft connection.

10. In the terminal implementation

Php-i|grep INI
View loaded INI file, this article assumes PHP profile a

11. Back up PHP configuration file a

12. In the terminal implementation

Ln-s/application/mamp/bin/php/php[php version a]/conf/php.ini php config file a
13. In the terminal implementation

Php-i|grep INI
At this point the path should be consistent with what is seen in the browser.

To install any extensions later, follow these steps

1.sudo pecl Install [extension]
2. Edit/application/mamp/bin/php/php[php version a]/conf/php.ini load extension
3. Restart the Web server
For any questions please leave a comment below.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.