顯示具有 apache 標籤的文章。 顯示所有文章
顯示具有 apache 標籤的文章。 顯示所有文章

2016-04-25

你的 MAC 的 PHP 的指令 ImageTTFText 無效或沒動作?

你的 MAC 的 PHP 的指令 ImageTTFText 無效或沒動作?
例如這行無動作
ImageTTFText($img_org, 14, angle, $pos[1], $pos[2], $thecolor, $ttf_font, $text_out);

大致上應該是兩個問題造成
1. 沒有安裝 GD 程式 library
2. 沒有安裝 freetype font support


2015-07-29

Using .htaccess to redirect from one domain to another

If you want to redirect your www.from.com  to  www.to.com

[.htaccess]
in your root directory(or sub-directory, according to ur needs), create an .htaccess file, and input content below.


RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.from.com$ [NC]
RewriteRule ^(.*)$ http://www.to.com/$1 [R=301,L]


[例子]
RewriteEngine On
# 從  from.com  轉到 www.to.info
RewriteCond %{HTTP_HOST} ^from\.com$ [NC]
RewriteRule ^(.*)$ http://www.to.info/$1 [L,R=301]
# 從  www.from.com  轉到 www.to.info
RewriteCond %{HTTP_HOST} ^www\.from\.com$ [NC]
RewriteRule ^(.*)$ http://www.to.info/$1 [R=301,L]



[try]

go to browser URL input http://www.from.com/account/login and then you will be redirected to http://www.to.com/account/login

URI is corrected be mapped.





2014-06-10

Centos6.x 下 Apache2.2 + mod_wsgi + django embedded mode 之安裝設定(無廢話)

前言
Django 要能透過 mod_wsgi 結合 Apache 正常運作首先
1. 你必需要安裝好 Apache
2. 你必需要安裝好 Python, 請參考這篇
3. Apache 必需安裝好 mod_wsgi, 請參考 這篇

安裝 Django
接下來就是安裝 Django, 安裝方法很簡單, 指令如下(這裡我是雙系統, python/pip, python3.3/pip3.3, 請依自己環境使用 pip 或pipx.x)
#pip3.3  install  django


2014-06-05

mod_wsgi 跟 Apache 的 config (無廢話)

若你要安裝 mod_wsgi 請看這篇
若你要設定 mod_wsgi 使其運作則請繼續

環境
Apache2.2
mod_wsgi 4.1.3




httpd.conf 設定
打開 httpd.conf 找到一堆 LoadModule 的地方, 在下方加入以下這行
LoadModule wsgi_module modules/mod_wsgi.so
存檔離開, 重啟 apache
#apachectl restart

若 wsgi 成功運作則你可以在 [apache]/log/error_log 看到以下訊息
 Apache/2.2.15 (Unix) DAV/2 mod_wsgi/4.1.3 Python/3.3.3 configured


在 Centos 下安裝 mod_wsgi (無廢話版)

前言
mod_python 及 mod_wsgi 要安裝哪一個較好?
若你 goo 完資料後答案很明顯, 就是 mod_wsgi. 因為
1. mod_wsgi 效率較好
2. mod_python 最後會淘汰不再更新



2014-02-26

CentOS6 php 無法使用 ftp_connect 的解決辦法

雖然常常遇到,但每每遇到又會忘記,所以在此筆記。

在 Security Enhanced Linux 下,Apache 可能不能如你原來習慣的方式使用。

在 PHP 下,當你遇到連 connect 都會失敗時
<testftp.php>
$conn_id = ftp_connect($ip,$port,$timeout);
if (!$conn_id)
{
    print "FTP connect failed!!";
    exit();
}