Ubuntu 14.04 64bit 编译安装Nginx1.7+PHP5.4+MySQL5.6(2)

sudo cp php.ini-development /opt/software/php/etc/php.ini
sudo ln -s /opt/software/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
sudo cp /opt/software/php/etc/php-fpm.conf.default /opt/software/php/etc/php-fpm.conf

8. 安装PHP扩展

cd ../m4-1.4.17/
./configure --prefix=/opt/software/libs
sudo make && sudo make install
export PATH=/home/davidhhuan/setup/m4-1.4.17:$PATH

cd ../autoconf-2.69/
./configure --prefix=/opt/software/libs
sudo make && sudo make install

cd ../memcache-2.2.7/
export PHP_AUTOCONF="/opt/software/libs/bin/autoconf"
export PHP_AUTOHEADER="/opt/software/libs/bin/autoheader"
/opt/software/php/bin/phpize
./configure --with-php-config=/opt/software/php/bin/php-config
sudo make && sudo make install

9. 设置开机自启动

Nginx

sudo vim /etc/init.d/nginx

内容如下

#! /bin/sh

### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:    $local_fs $remote_fs $network $syslog
# Default-Start:    2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:      starts nginx using start-stop-daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/software/nginx/sbin/nginx
NAME=nginx
DESC=nginx

DAEMON_OPTS=''

test -x $DAEMON || exit 0

# Include nginx defaults if available
#if [ -f /etc/default/nginx ] ; then
#      . /etc/default/nginx
#fi

set -e

. /lib/lsb/init-functions

#test_nginx_config() {
#  if $DAEMON -t $DAEMON_OPTS
#  then
#    return 0
#  else
#    return $?
#  fi
#}

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON || true
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON || true
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON || true
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON || true
        echo "$NAME."
        ;;
  reload)
        echo -n "Reloading $DESC configuration: "
        start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
            --exec $DAEMON || true
        echo "$NAME."
        ;;
  status)
        status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
        ;;
  *)
        echo "Usage: $NAME {start|stop|restart|reload|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

sudo update-rc.d nginx defaults

php-fpm

sudo cp /opt/setup/php-5.4.29/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
sudo groupadd nobody
sudo touch /opt/software/php/var/run/php-fpm.pid
sudo update-rc.d php-fpm defaults
vim /etc/init.d/php-fpm

替换如下内容

prefix=@prefix@
exec_prefix=@exec_prefix@

php_fpm_BIN=@sbindir@/php-fpm
php_fpm_CONF=@sysconfdir@/php-fpm.conf
php_fpm_PID=@localstatedir@/run/php-fpm.pid

变成

prefix=/opt/software/php
exec_prefix=/opt/software/php/bin

php_fpm_BIN=/opt/software/php/sbin/php-fpm
php_fpm_CONF=/opt/software/php/etc/php-fpm.conf
php_fpm_PID=/opt/software/php/var/run/php-fpm.pid

MySQL

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/225d8495e22a3e6000925cf808f80dfd.html