本文目錄一覽:
- 1、linux php怎樣使用https
- 2、https下php代碼無法運行?
- 3、PHP怎樣處理HTTPS請求
- 4、php程序員用PHP如何實現https方式訪問
- 5、怎麼通過https+ip+443埠訪問pay.php這個文件
linux php怎樣使用https
這個同CGI,ASP一樣,是一種用於網路或網站的程序文件。對於瀏覽者,這種文件顯示結果跟HTML文件是一樣的。最簡單的就是使用記事本就可以打開PHP文件,如果是作開發,安裝專業的編輯器(如editplus等等)就更方便
應該就是這樣了,我解釋的不夠詳細,你可以去後盾人那,他那裡有很多專家教學,非常詳細
https下php代碼無法運行?
先要確定這個 https的網站能不能訪問,先放個 html 的網站去,如果不能訪問,說明你埠或者 http 伺服器沒有配置好。
如果能訪問,就在 php 代碼中搜索一下 https 和443 ,看一下有沒有與 https 相關的代碼,再查找問題所在。
PHP怎樣處理HTTPS請求
您好,我來為您解答:
$context = stream_context_create(array(‘ssl’ =array(
‘local_cert’ =’./https.pem’,
)));
if(!$server = stream_socket_server(“ssl 0.0.0.0:2016”, $err_no, $err_msg, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context)){
exit($err_msg);
}
while(1){
$client = stream_socket_accept($server);
if ($client) {
stream_set_blocking($client, 0);
$in = ”;
while($ret = fread($client, 8192)) $in .= $ret;
$response = “HTTP/1.0 200 OK\r\n\r\nHello”;
fwrite($client, $response);
fclose($client);
}
}
希望我的回答對你有幫助。
php程序員用PHP如何實現https方式訪問
SSL證書安裝到伺服器環境裡面安裝的,不是安裝到語言編程語言的。
一、如果程序員要實現,具備一台獨立伺服器或雲伺服器。
二、確定好需要實現HTTPS方式的域名(網址)。
三、登陸淘寶搜索:Gworg 獲取SSL證書,辦理認證手續。
四、拿到證書安裝到伺服器就可以了,不會安裝建議讓簽發機構安裝。
怎麼通過https+ip+443埠訪問pay.php這個文件
目錄(?)[-]
介紹
語法
-new
-subj 替換或指定證書申請者的個人信息
-newkey arg 生成私鑰和證書請求類似與-new-xf09 生成自簽名證書
產生自簽名的root CA
證書請求及簽名
opensl req fym0121@163.com
介紹
openssl req 用於生成證書請求,以讓第三方權威機構CA來簽發,生成我們需要的證書。req 命令也可以調用x509命令,以進行格式轉換及顯示證書文件中的text,modulus等信息。如果你還沒有密鑰對,req命令可以一統幫你生成密鑰對和證書請求,也可以指定是否對私鑰文件進行加密。
語法
openssl req[-inform PEM|DER] [-outform PEM|DER] [-in filename] [-passin arg] [-out filename] [-passout arg] [-text] [-pubkey] [-noout] [-verify] [-modulus] [-new] [-rand file(s)] [-newkey rsa:bits] [-newkey alg:file] [-nodes] [-key filename] [-keyform PEM|DER] [-keyout filename] [-keygen_engine id] [-[digest]] [-config filename] [-subj arg] [-multivalue-rdn] [-x509] [-days n] [-set_serial n] [-asn1-kludge] [-no-asn1-kludge] [-newhdr] [-extensions section] [-reqexts section] [-utf8] [-nameopt] [-reqopt] [-subject] [-subj arg] [-batch] [-verbose] [-engine id]
-new
這個選項用於生成一個新的證書請求,並提示用戶輸入個人信息。如果沒有指定-key 則會先生成一個私鑰文件,再生成證書請求。
[cpp] view plain copy print?
E:\OpenSSL\fooopenssl req -new -key rsa_pri_nopw.pem -out crs.pemLoading ‘screen’ into random state – doneYou are about to be asked to enter information that will be incorporatedinto your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:HeBeiLocality Name (eg, city) []:SJZ
Organization Name (eg, company) [Internet Widgits Pty Ltd]:CCITOrganizational Unit Name (eg, section) []:CCITCommon Name (eg, YOUR name) []:fym
Email Address []:fym0121@163.com
Please enter the following ‘extra’ attributesto be sent with your certificate request
A challenge password []:
An optional company name []:
E:\OpenSSL\fools
crs.pem
rsa_pri_nopw.pem
沒有指定-key選項時,會生成私鑰文件,默認是有密碼保護的,-nodes(no des),可以明確指定不需要密碼保護。-keyout可以指定生成的私鑰文件名,-pubout可以指定生成的公鑰文件名[cpp] view plain copy print?
openssl req -new -out crs.pem
openssl req -new -out crs.pem -nodes
-subj 替換或指定證書申請者的個人信息
格式是:/type0=value0/type1=value1/type2=…(其中C是Country,ST是state,L是local,O是Organization,OU是Organization Unit,CN是common name)[cpp] view plain copy print?
E:\OpenSSL\fooopenssl req -new -key rsa_pri_nopw.pem -out crs.pem -subj /C=CN/ST=HB/L=SJZ/O=CCIT/OU=CCIT/CN=fym/emailAddress=fym0121@163.comLoading ‘screen’ into random state – done-newkey arg 生成私鑰和證書請求,類似與-newarg的格式是rsa:nbit ,還有幾個格式,我只能看懂這個[cpp] view plain copy print?
openssl req -newkey rsa:1024 -out crs.pem-xf09 生成自簽名證書
[cpp] view plain copy print?
openssl req -newkey rsa:1024 -x509 -nodes -out selfsing.pem-config 指定配置文件,參見config
產生自簽名的root CA
1、建立目錄結構(參加ca directory structure)假設當前工作目錄為E:\OpenSSL\foo,在此目錄下建立以下目錄結構[cpp] view plain copy print?
E:\OpenSSL\foomkdir demoCA
E:\OpenSSL\foomkdir demoCA\private demoCA\newcerts在demoCA目錄下建立兩個空文件,serial和index.txt,並向serial文件中寫入”01″兩個字元2、產生自簽名證書,作為root ca使用
[cpp] view plain copy print?
E:\OpenSSL\fooopenssl req -new -x509 -keyout cakey.pem -out cacert.pem提示輸入密碼保護私鑰,和自簽名root ca的信息。生成兩個文件,將cakey.pem放到demoCA\private目錄下,將cacert.pem放到demoCA目錄下。
[cpp] view plain copy print?
E:\OpenSSL\foomove cacert.pem demoCA
E:\OpenSSL\foomove cakey.pem demoCA\private至此,root ca已經建立完畢。
證書請求及簽名
1、生成請求
[cpp] view plain copy print?
E:\OpenSSL\fooopenssl req -new -nodes -out req.pem提示輸入個人信息,最後生成req.pem證書請求文件。
2、簽名,生成證書
[cpp] view plain copy print?
E:\OpenSSL\fooopenssl ca -in req.pem -out newcert.pemUsing configuration from e:\OpenSSL\bin\openssl.cfgLoading ‘screen’ into random state – doneEnter pass phrase for ./demoCA/private/cakey.pem:
Check that the request matches the signatureSignature ok
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/189204.html