2012年8月31日 星期五

ubuntu server symfony


http://www.joelverhagen.com/blog/2011/05/how-to-configure-symfony-2-0-on-ubuntu-server-2011-4/

Download and Extract

  1. Download the framework from the Symfony website. Here's a link, because the only reason you're reading this is because you're lazy. I am working with the Symfony Standard 2.0 BETA1 (.tgz) package.
  2. Either download the package directly to your /var/www directory or move it there yourself. Cool people use wget.
    cd /var/www
    wget -O symfony.tgz http://symfony.com/download?v=Symfony_Standard_Vendors_2.0.0BETA1.tgz
    tar xfz symfony.tgz
    wget -O symfony.tgz http://symfony.com/download?v=Symfony_Standard_Vendors_2.0.17.tgz 
  3. You'll now have a directory labelled Symfony in your /var/www directory
  1. Change the permissions of the app/cache/ directory so that the web server can write into it.
    sudo chmod -R 777 /var/www/Symfony/app/cache
    
  2. Change the permissions of the app/logs/ directory so that the web server can write into it.
    sudo chmod -R 777 /var/www/Symfony/app/logs  

  • app_dev.php: This is a front controller. It is the unique entry point of the application and it responds to all user requests;
  • /demo/hello/Fabien: This is the virtual path to the resource the user wants to access.


將 symfony 解壓縮到網頁根目錄之後,

由於 ubuntu server 是文字介面,
如果想要從遠端連線到主機,以 symfony 提供的網頁介面進行設定

因為 symfony 網頁介面的檔案中,有允許IP清單,會自動比對連線 IP,
預設僅允許本機IP進行網頁介面設定
所以需要將遠端 IP 加入允許清單中

if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !in_array(@$_SERVER['REMOTE_ADDR'], array(
        '127.0.0.1',
        '::1',
        '192.168.200.80',//自行加入遠端 IP
    ))
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

2012年8月30日 星期四

Linux Remove Entire Directory Command

To remove all directories and subdirectories use rm command. For example remove letters and all subdirectories and files inside this directory, type the following command (warning all files including subdirectories will be deleted permanently):
$ rm -rf letters/

複製備份資料夾指令:cp -r


 關鍵字:
win shell copy directory

網址:
http://commandwindows.com/xcopy.htm

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...] 
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
XCOPY source /E

關鍵字:
ubuntu cp directory

網址:
http://askubuntu.com/questions/35779/what-does-cp-omitting-directory-mean

內容:
By default, cp copies only the direct files in, and not subdirectories in the directory. The message cp: omitting directory 'directory' warns you that the mentioned directory is not copied.
To do so, specify the -r (or --recursive) option:
sudo cp -r ~/Transfers/ZendFramework-1.11.4-minimal/library/Zend/* ~/public_html/cmsk.dev/library/

2012年8月29日 星期三

xampp ubuntu 開機時自動啟動




xampp ubuntu 開機時自動啟動


ubuntu server (startup OR boot)xampp

http://ubuntuforums.org/showthread.php?t=1584852

1) Navigate to /etc/init.d
eg ' 
cd /etc/init.d/
'
2) Create a new file with nano eg 'nano'
sudo vi startup_lampp
3) Put the following into the file
#!/bin/sh
/opt/lampp/lampp start


4) Give execution permission to the file
eg '
sudo chmod +x startup_lampp
'
5) Check this by typing 'ls -l lampp' , the filename should be green if it worked
6) now use the following command to add it to startup runlevels
' 
update-rc.d -f startup_lampp defaults
sudo update-rc.d -f startup_lampp defaults
'


2012年8月28日 星期二

command1 | command2
executes command1, using its output as the input for command2

2012年8月27日 星期一

安裝 xampp 到 64 bit ubuntu


sudo tar xvfz download.php?xampp-linux-1.8.0.tar.gz -C /opt
我遇到一個問題:安裝 xampp 到 64 bit ubuntu

所以我使用以下的關鍵字:
64 bit ubuntu xampp

google 到一個網頁:
http://preprocess.me/how-to-run-xampp-on-64-bit-linux

網頁中看到了一個指令:
sudo apt-get install ia32-libs

指令執行結果:xampp 順利執行了