Compiling a tutorial _php instance of installing the NGINX+PHP+MARIADB Development environment on Mac OS

Source: Internet
Author: User
Tags mcrypt openssl library php source code
Because of the urine nature of Oracle. MARIADB should have replaced MySQL. So abandon MySQL.

1, compile Nginx
Download Nginx,openssl,pcre separately
When you compile OpenSSL, you will be prompted

warning! If you wish to build 64-bit library and then you have Toinvoke './configure darwin64-x86_64-cc ' *manually*.

If you do not stop compiling, you will get an error. This question should be the Openssl/config script guess to your system is 64 bit, but will be based on $kernel_bits to determine whether to turn on x86_64 compilation, default is not open (very strange settings, although will give you 5 seconds to stop compiling and manually open), So the OpenSSL library file you generated is 32 bits, and the last static link to Nginx will make an error. There seems to be no good way to pass the x86_64 parameters to the OpenSSL configuration file (Openssl/config Guess OS architecture, set whether the compiled parameter is 32-bit or 64-bit, default is 32 bit, and then call openssl/ Configure generate Makefile)

Can export kernel_bits=64 before configure, if still not working
I'm going to change it.
Go to Nginx Directory

Copy the Code code as follows:
$./configure./configure–prefix=/usr/locale/nginx–with-openssl=. /openssl-1.0.1i–with-pcre=. /pcre-8.33

To manually modify the Objs/makefile:

./config–prefix=/users/xxx/downloads/openssl-1.0.1e/.openssl no-shared No-threads

Change into

Copy the Code code as follows:
./configure Darwin64-x86_64-cc–prefix=/users/xxx/downloads/openssl-1.0.1e/.openssl no-shared no-threads

Make again
2, compiling PHP
Download PHP source code and some class libraries
zlib:http://www.zlib.net/
GD Library: https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz Bad
freetype:http://sourceforge.net/projects/freetype/
Libpng:http://www.libpng.org/pub/png/libpng.html
libjpeg:http://www.ijg.org/

Curl:http://curl.haxx.se/download.html

mhash:http://sourceforge.net/projects/mhash/
mcrypt:http://mcrypt.hellug.gr/
and a bzip2. GetText and Libtool in the GNU official website, but the speed is not good, the other library I use the system comes with. Too lazy to toss, then nothing to mend what.
In addition to libtool directly thrown in the/usr, the other I installed in the/usr/local of a separate directory inside. For example, JPEG is/usr/local/jpeg convenient to modify later

Copy the Code code as follows:

./configure–prefix=/users/saint/bin/php–enable-inline-optimization–enable-fpm–with-mcrypt=/usr/local/libmcrypt –with-zlib–enable-mbstring–with-openssl–with-mysql–with-mysqli–with-mysql-sock–with-gd–with-jpeg-dir=/usr/ local/jpeg–enable-gd-native-ttf–enable-pdo–with-gettext–with-curl–with-pdo-mysql–enable-sockets–enable-bcmath– enable-xml–with-bz2=/usr–enable-zip–enable-freetype–with-png-dir=/usr/local/libpng–with-pcre-regex– With-iconv-dir=/usr–with-gettext=/usr/local/gettext

3. Compiling mariadb

Compiling MARIABD requires installing CMake first. Go to www.cmake.org download Install tar zxf mariadb-5.5.32.tar.gz

CD Mariadb-5.5.32cmake. -DCMAKE_INSTALL_PREFIX=/USR/LOCAL/MARIADB \
-dmysql_unix_addr=/tmp/mysql.sock \-dmysql_datadir=/data/mariadb \-dsysconfdir=/usr/local/mariadb \-DMYSQL_USER= MySQL \-dmysql_tcp_port=3306 \-dwith_xtradb_storage_engine=1 \-dwith_innobase_storage_engine=1 \-DWITH_PARTITION_ storage_engine=1 \-dwith_blackhole_storage_engine=1 \-dwith_myisam_storage_engine=1 \-DWITH_READLINE=1 \-DENABLED_ local_infile=1 \-dwith_extra_charsets=1 \-ddefault_charset=utf8 \-ddefault_collation=utf8_general_ci \-DEXTRA_ Charsets=all \-dwith_big_tables=1 \-dwith_debug=0
Make && make INSTALL/BIN/CP SUPPORT-FILES/MY-SMALL.CNF/USR/LOCAL/MARIADB/MY.CONFCP support-files/ mysql.server/usr/local/mariadb/mysqld# MY.CF

Copy the Code code as follows:

Cat >/etc/my.cnf << EOF [mysqld] Basedir =/usr/local/mariadb DataDir =/data/mariadb Pid-file =/data/mariadb/m Ariadb.pid character-set-server = UTF8 Collation-server = Utf8_general_ci user = MySQL Port = 3306 default_storage_engine = InnoDB Innodb_file_per_table = 1 server_id = 1 Log_bin = Mysql-bin Binlog_format = Mixed Expire_logs_days = 7 Bind-addre SS = 0.0.0.0 # name-resolve skip-name-resolve skip-host-cache #lower_case_table_names = 1 Ft_min_word_len = 1 query_cache_ Size = 64M Query_cache_type = 1 skip-external-locking key_buffer_size = 16M Max_allowed_packet = 1M Table_open_cache = 64 Sort_buffer_size = 512K Net_buffer_length = 8K Read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # LOG log_error =/data/mariadb/mariadb-error.log long_query_time = 1 Slow_query_log slow_query_log_file =/data/mar Iadb/mariadb-slow.log # oher #max_connections = Open_files_limit = 65535 [client] port = 3306 eof/usr/local/mariadb/ scripts/mysql_install_db --user=mysql--basedir=/usr/local/mariadb--datadir=/data/mariadb chown mysql.mysql-r/data/mariadb export PATH= $PATH :/usr/local/mariadb/bin Echo ' Export path= $PATH:/usr/local/mariadb/bin ' >>/etc/profile
Source/etc/profile

/USR/LOCAL/MARIADB/BIN/MYSQL-E "Grant all privileges on * * to root@ ' 127.0.0.1′identified by" dbrootpwd "with Grant Opti On; " /USR/LOCAL/MARIADB/BIN/MYSQL-E "Grant all privileges on * * to root@ ' localhost ' identified by" Dbrootpwd "with Grant Opti On; " /usr/local/mariadb/bin/mysql-uroot-pdbrootpwd-e "Delete from Mysql.user where password="; " /usr/local/mariadb/bin/mysql-uroot-pdbrootpwd-e "Delete from mysql.db where user="; " /USR/LOCAL/MARIADB/BIN/MYSQL-UROOT-PDBROOTPWD-E "drop database test;"

4. Subsequent installation extensions
PHP provides a phpize tool for us to install the required extensions.

The following describes the use of phpize:

(1). Find your original compiled PHP installation directory, for example my directory is/home/saint/development/php, in this directory, find Bin/phpize. If you do not have this tool, then you do not have the tool installed, so you will need to install Php.dev, which is usually the tool.

(2). To expand, you need a PHP source package that is the same as the version of PHP that is currently installed, and the current PHP version can be viewed with phpinfo ().

(3). Open the source package directory, go to the EXT directory, for example I entered into:/home/saint/development/php-5.5.6/ext, ext under the various PHP with the extension module, into the ext/sockets.

(4). After CD to Ext/sockets, run the Phpize program:

/home/saint/development/php/bin/phpize

After execution, you can see that phpize will help us generate the corresponding configure file.

(5). Configure by configure, execute the following command:

./configure--enable-sockets--with-php-config=/home/saint/development/php/bin/php-config make make and install

Note: The Php-config file is in the same directory as the Phpize

(6). Change the php.ini and add the following statement:

Copy the Code code as follows:

extension= "/home/saint/development/php/lib/php/extensions/no-debug-non-zts-20121226/sockets.so"

I think it's ugly. You can delete that date folder

(7). Restart Nginx

  • Related Article

    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.