カテゴリー別アーカイブ: 未分類

httpd.confのディレクティブの入れ子設定

通常はPHP7(モジュール)で動かしているサイトの、特定ディレクトリだけPHP5(CGI)で動かしたくて試行錯誤。

もともと、PHP7のほうは、
SetHandler application/x-httpd-php

PHP5のほうは
AddHandler fcgid-script .php

で、設定していた。

DirectoryMatchとか、FilesMatchでうまいことできないか試してみてもうまくいかず。

結局、まず最初にPHP7の設定を、
AddHandler application/x-httpd-php .php

で、設定して、特定ディレクトリのほうを、
SetHandler fcgid-script

で、上書きすることで対応した。

なんか、あんまスマートじゃない。

電卓ボタンから電卓の複数起動を回避する試行錯誤

マイクロソフトのエルゴノミック系のキーボードを使っている。
テンキーに電卓ボタンがついていて便利なのだが、押すたびに電卓が立ち上がる。
複数起動を避けるために試行錯誤したメモ。

system32/calc.exeがランチャーの様子。
これをいじりたかったけど、権限がうんたらでうまくいかず。

batかvbsで、電卓を立ち上げる、立ち上がっていればフォーカスを与えるようにする。

いろいろ試したけど、vbsのWscript.ShellのAppActivateで電卓にフォーカスを与えることができず。
メモ帳とかはOK。UWPだから?
仕方ないので、適当な電卓ソフトを探してきて、設置。

VBSを準備

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Const strCalcExe = "BunCalc.exe" 'プロセス名
 
call ActiveCalc
 
sub ActiveCalc()
    Dim objWshShell
    Dim calcID
    
    calcID=GetProcID(strCalcExe)
 
 
    'MsgBox calcID
 
    Set objWshShell = CreateObject("Wscript.Shell")
 
    IF calcID = 0 Then
       strCmdLine = "D:\nonInstallPrograms\BunCalc\BunCalc.exe"
       Set objExecCmd = objWshShell.Exec(strCmdLine)
    Else
       objWshShell.AppActivate calcID
    End If
 
 
    Set objWshShell = Nothing
End Sub
 
Function GetProcID(ProcessName)
    Dim Service
    Dim QfeSet
    Dim Qfe
    Dim RetInt
 
    Set Service = WScript.CreateObject("WbemScripting.SWbemLocator").ConnectServer
    Set QfeSet = Service.ExecQuery("Select * From Win32_Process Where Caption='"& ProcessName &"'")
 
    RetInt = 0
    
    For Each Qfe in QfeSet
        RetInt =  Qfe.ProcessId
        Exit For
    Next
 
    GetProcID = RetInt
End Function
Const strCalcExe = "BunCalc.exe" 'プロセス名

call ActiveCalc
 
sub ActiveCalc()
    Dim objWshShell
    Dim calcID
    
    calcID=GetProcID(strCalcExe)


    'MsgBox calcID

    Set objWshShell = CreateObject("Wscript.Shell")

    IF calcID = 0 Then
       strCmdLine = "D:\nonInstallPrograms\BunCalc\BunCalc.exe"
       Set objExecCmd = objWshShell.Exec(strCmdLine)
    Else
       objWshShell.AppActivate calcID
    End If


    Set objWshShell = Nothing
End Sub
 
Function GetProcID(ProcessName)
    Dim Service
    Dim QfeSet
    Dim Qfe
    Dim RetInt
 
    Set Service = WScript.CreateObject("WbemScripting.SWbemLocator").ConnectServer
    Set QfeSet = Service.ExecQuery("Select * From Win32_Process Where Caption='"& ProcessName &"'")

    RetInt = 0
    
    For Each Qfe in QfeSet
        RetInt =  Qfe.ProcessId
        Exit For
    Next
 
    GetProcID = RetInt
End Function

キーの割り当ては、レジストリ。
電卓ボタンは18番らしい。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18
文字列値を新規で追加する

名前 ShellExecute
値 VBSファイルの絶対パス

PLESK11ではまったこと httpd.conf

それぞれのドメインのapacheのconfは、
/var/www/vhosts/DOMAIN_NAME/conf

に、あるっぽい。そのなかのhttpd.includeは編集してはならず、
vhost.conf
vhost_ssl.conf
を作成してそこに書く必要がある

それだけではだめで、pleskに認識させる必要があるので下記コマンド

/usr/local/psa/admin/sbin/httpdmng –reconfigure-domain DOMAIN_NAME

/usr/local/psa/admin/sbin/httpdmng –reconfigure-all

今回は、fcgiのmaxRequestLen


FcgidMaxRequestLen 60485760

Win8.1にApacheとPHPをインストールしようとしてはまったこと

モジュールでPHPを読み込んで、httpd.confを書き換えてApacheを起動しようとすると、

httpd:Syntax Error on Line 135 of C:/apache/Apache22/conf/httpd.conf:Cannot load c:\php\php5apache2_2.dll into server ——–

と、なる。

どうやら、PHPが32bit版で、Apacheが64bit版だったのが問題。Apacheを32bitにしたら動いた。