2015年2月11日 星期三

PHP.ini 設定 MySQL

一、先安裝autoconf
sudo apt-get install autoconf

二、安裝PHP裡mysql套件
cd php-5.5.15/ext/mysql
sudo phpize
sudo ./configure --enable-mysql
sudo make
sudo make test
sudo make install

三、安裝PHP裡mysqli套件
cd ../mysqli
sudo phpize
sudo ./configure --enable-mysqli
sudo make
sudo make test
sudo make install

四、安裝PHP裡pdo_mysql套件
cd ../pdo_mysql
sudo phpize
sudo ./configure --enable-pdo_mysql
sudo make
sudo make test
sudo make install

四、php.ini設定
修改底下把;拿掉
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
extension=mysql.so
extension=mysqli.so
;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
extension=pdo_mysql.so
重啟Apache2 server
sudo service apache2 restart

How to install MySQL5.6 binary on ubuntu14.10(64Bit)

軟體準備
  • mysql-5.6.19.tar.gz

一、MySQL下載及安裝
sudo wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.19.tar.gz
sudo gzip -d mysql-5.6.19.tar.gz
sudo tar xvf mysql-5.6.19.tar
sudo groupadd mysql
sudo useradd -g mysql mysql
cd mysql-5.6.19
sudo cmake -DWITH_INNOBASE_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/var/tmp/mysql.sock -DSYSCONFDIR=/etc .
sudo make
sudo make install

二、權限修改或設定
cd /usr/local/mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
sudo scripts/mysql_install_db --user=mysql

三、設定MySQL啟動時間
sudo su mysql
./bin/mysqld_safe start
cd /usr/local/mysql
sudo chown -R root .
sudo chown -R mysql data
sudo cp support-files/mysql.server /etc/init.d/mysql.server
sudo /etc/init.d/mysql.server start
sudo update-rc.d mysql.server defaults
sudo ln -s /usr/local/mysql/bin/* /usr/local/bin/
sudo mysql_secure_installation


參考鏈結:https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/

How to install PHP5 binary on ubuntu14.10

軟體準備
  • php-5.5.15.tar.gz

一、下載及安裝
sudo wget http://us1.php.net/distributions/php-5.5.15.tar.gz
sudo gzip -d php-5.5.15.tar.gz
sudo tar xvf php-5.5.15.tar
cd php-5.5.15
sudo ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --with-gd --with-mhash --with-mcrypt --with-curl --with-openssl --with-zlib --with-jpeg-dir --with-png-dir --with-pcre-regex --enable-calendar --enable-exif --enable-ftp --enable-mbstring --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip
sudo make
sudo make test
sudo make install
cp php.ini-development /usr/local/lib/php.ini
sudo mkdir java

二、與Apache2整合
sudo vim /usr/local/apache2/conf/httpd.conf
請先找到的訊息:
#LoadModule php5_module        modules/libphp5.so
註解拿掉:
LoadModule php5_module        modules/libphp5.so
在最底下新增以下的訊息:
<filesmatch \.php$="">
    SetHandler application/x-httpd-php
</filesmatch>
AddType application/x-httpd-php .php .html .htm
AddHandler php5-script  .php  
儲存後,離開。
重啟Apache2 server
sudo service apache2 restart

三、測試PHP
sudo vim /usr/local/apache2/htdocs/info.php
內容為底下:
<?php
 phpinfo();
?>
測試鏈結以下:
http://127.0.0.1/info.php  


參考鍵結:
https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/
http://www.rootusers.com/installing-apache-2-4-and-php-5-4-from-source/

How to install JDK8 binary on ubuntu14.10(64Bit)

軟體準備

一、準備要放JDK的路徑
cd /usr/local
sudo mkdir java

二、將檔案解壓縮
cd /usr/local/java
sudo tar xzvf ~/Downloads/jdk-8u31-linux-x64.tar.gz

三、Ubuntu更新JDK8安裝位置
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_31/jre/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_31/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_31/jre/bin/javaws" 1
sudo update-alternatives --set java /usr/local/java/jdk1.8.0_31/jre/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_31/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_31/jre/bin/javaws

查看路徑是否設定成功
cd /usr/bin
ls -ld java*
以下訊息:
lrwxrwxrwx 1 root root 22 Mar 31 20:41 java -> /etc/alternatives/java
lrwxrwxrwx 1 root root 23 Mar 31 20:42 javac -> /etc/alternatives/javac
lrwxrwxrwx 1 root root 24 Mar 31 20:42 javaws -> /etc/alternatives/javaws
cd /etc/alternatives
ls -ld java*
以下訊息:
lrwxrwxrwx 1 root root 40 Aug 29 18:18 java -> /usr/local/java/jdk1.8.0_20/jre/bin/java
lrwxrwxrwx 1 root root 37 Aug 29 18:18 javac -> /usr/local/java/jdk1.8.0_20/bin/javac
lrwxrwxrwx 1 root root 42 Aug 29 18:19 javaws -> /usr/local/java/jdk1.8.0_20/jre/bin/javaws

查看java版本與路徑
javac -version
java -version
which javac
which java

四、設定JAVA PATH跟JAVA HOME
cd /etc
sudo vim profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_31
export PATH=$JAVA_HOME/bin:$PATH
儲存後離開
source /etc/profile
echo $JAVA_HOME
echo $PATH


參考鍵結:https://www3.ntu.edu.sg/home/ehchua/programming/howto/Ubuntu_HowTo.html#jdk

How to install Apache2.4 binary on ubuntu14.10(64Bit)

軟體準備
  • pcre-8.35.tar.gz
  • httpd-2.4.10.tar.gz
  • apr-1.5.1.tar.gz
  • apr-util-1.5.3.tar.gz

更新Ubuntu套件與安裝所需套件
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential gcc make cmake libssl-dev libxml2-dev libpng-dev libjpeg-dev libcurl4-openssl-dev libbz2-dev libncurses5 libncurses5-dev libaio1 libmcrypt-dev

一、Pcre下載及安裝
sudo wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
sudo gzip -d pcre-8.35.tar.gz
sudo tar xvf pcre-8.35.tar
cd pcre-8.35
sudo ./configure
sudo make
sudo make install

二、Apache2.4 + Apr + Apr-util 下載及安裝
sudo wget http://archive.apache.org/dist/httpd/httpd-2.4.10.tar.gz
sudo gzip -d httpd-2.4.10.tar.gz
sudo tar xvf httpd-2.4.10.tar
sudo wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
sudo gzip -d apr-1.5.1.tar.gz
sudo tar xvf apr-1.5.1.tar
sudo wget http://archive.apache.org/dist/apr/apr-util-1.5.3.tar.gz
sudo gzip -d apr-util-1.5.3.tar.gz
sudo tar xvf apr-util-1.5.3.tar
sudo mv apr-1.5.1 apr
sudo mv apr-util-1.5.3 apr-util
sudo mv apr apr-util httpd-2.4.10/srclib/
cd httpd-2.4.10
sudo ./configure --with-included-apr --with-pcre=/usr/local/bin/pcre-config --with-crypto --enable-ssl --enable-rewrite --enable-dav --enable-so --enable-http --enable-mime-magic --enable-info
sudo make
sudo make install

sudo /usr/local/apache2/bin/apachectl start
#Start Apache2 Server-會發生以下的錯誤

/usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

解決 Start Apache2 server 方法如下
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
sudo ldconfig
sudo /usr/local/apache2/bin/apachectl restart

三、設定Apache2啟動時間(Start Apache at Boot Time)
sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apache2
sudo chmod +x /etc/init.d/apache2
sudo update-rc.d apache2 defaults

四、增加Apache2 程式執行路徑
export PATH=$PATH:/usr/local/apache2/bin

五、設定Apache2路徑權限
sudo chown -R root:root /usr/local/apache2/
sudo chmod -R go-rwx /usr/local/apache2/
sudo chmod -R a-w /usr/local/apache2/
sudo chmod o+x /usr/local/apache2/
sudo chmod o+x /usr/local/apache2/htdocs/
sudo chmod o+x /usr/local/apache2/cgi-bin/
sudo chmod -R o+r /usr/local/apache2/htdocs/
sudo chmod -R u+w /usr/local/apache2/conf/ /usr/local/apache2/logs/


參考鏈結:https://www.virgohacks.net/install-apache-2-4-mysql-5-6-php-5-5-source-ubuntu-14-04/