"Php.ini의 위치"의 두 판 사이의 차이

잔글 (로봇: 자동으로 텍스트 교체 (-[root@jmnote +[root@zetawiki))
2번째 줄: 2번째 줄:
;php.ini의 위치
;php.ini의 위치


==개요==
<?php
*php.ini는 /etc에 있다.
$ftable = array (
*설정에 따라 달라질 수는 있음
  "openssl_cipher_iv_length",
          "openssl_csr_export_to_file",
          "openssl_csr_export",
          "openssl_csr_get_public_key",
          "openssl_csr_get_subject",
          "openssl_csr_new",
          "openssl_csr_sign",
          "openssl_decrypt",
          "openssl_dh_compute_key",
          "openssl_digest",
          "openssl_encrypt",
          "openssl_error_string",
          "openssl_free_key",
          "openssl_get_cipher_methods",
          "openssl_get_md_methods",
          "openssl_get_privatekey",
          "openssl_get_publickey",
          "openssl_open",
          "openssl_pkcs12_export_to_file",
          "openssl_pkcs12_export",
          "openssl_pkcs12_read",
          "openssl_pkcs7_decrypt",
          "openssl_pkcs7_encrypt",
          "openssl_pkcs7_sign",
          "openssl_pkcs7_verify",
          "openssl_pkey_export_to_file",
          "openssl_pkey_export",
          "openssl_pkey_free",
          "openssl_pkey_get_details",
          "openssl_pkey_get_private",
          "openssl_pkey_get_public",
          "openssl_pkey_new",
          "openssl_private_decrypt",
          "openssl_private_encrypt",
          "openssl_public_decrypt",
          "openssl_public_encrypt",
          "openssl_random_pseudo_bytes",
          "openssl_seal",
          "openssl_sign",
          "openssl_verify",
          "openssl_x509_check_private_key",
          "openssl_x509_checkpurpose",
          "openssl_x509_export_to_file",
          "openssl_x509_export",
          "openssl_x509_free",
          "openssl_x509_parse",
          "openssl_x509_read"
          );
  for ($i=0; $i<count($ftable); $i++) {
      if(function_exists($ftable[$i]))
                printf("'%s' is installed\n", $ftable[$i]);
        else
                printf("'%s' not installed*********\n", $ftable[$i]);
  }
  //echo PHP_VERSION;
  if (PHP_VERSION < '5.3.0') {
  printf("openssl_encrypt function is not executed under php 5.3\n");
  exit();
  }
  $string = "1234567890ABCDeFGHIJ";
        $pass = "1234";
        $method = "aes128";
        printf("Plain = %s\n", $string);
       
        $encrypted = openssl_encrypt($string, $method, $pass);
       
        printf("encrypted[%d]=%s\n", strlen($encrypted), md5($encrypted));
       
        $decrypted = openssl_decrypt($encrypted, $method, $pass);
        printf("decrypted[%d]=%s\n", strlen($decrypted), $decrypted);
       
        exit();
?>


==php의 위치==
==php의 위치==

2016년 3월 24일 (목) 13:40 판

php.ini의 위치

<?php

$ftable = array (
 "openssl_cipher_iv_length",
         "openssl_csr_export_to_file",
         "openssl_csr_export",
         "openssl_csr_get_public_key",
         "openssl_csr_get_subject",
         "openssl_csr_new",
         "openssl_csr_sign",
         "openssl_decrypt",
         "openssl_dh_compute_key",
         "openssl_digest",
         "openssl_encrypt",
         "openssl_error_string",
         "openssl_free_key",
         "openssl_get_cipher_methods",
         "openssl_get_md_methods",
         "openssl_get_privatekey",
         "openssl_get_publickey",
         "openssl_open",
         "openssl_pkcs12_export_to_file",
         "openssl_pkcs12_export",
         "openssl_pkcs12_read",
         "openssl_pkcs7_decrypt",
         "openssl_pkcs7_encrypt",
         "openssl_pkcs7_sign",
         "openssl_pkcs7_verify",
         "openssl_pkey_export_to_file",
         "openssl_pkey_export",
         "openssl_pkey_free",
         "openssl_pkey_get_details",
         "openssl_pkey_get_private",
         "openssl_pkey_get_public",
         "openssl_pkey_new",
         "openssl_private_decrypt",
         "openssl_private_encrypt",
         "openssl_public_decrypt",
         "openssl_public_encrypt",
         "openssl_random_pseudo_bytes",
         "openssl_seal",
         "openssl_sign",
         "openssl_verify",
         "openssl_x509_check_private_key",
         "openssl_x509_checkpurpose",
         "openssl_x509_export_to_file",
         "openssl_x509_export",
         "openssl_x509_free",
         "openssl_x509_parse",
         "openssl_x509_read"
         );

 for ($i=0; $i<count($ftable); $i++) {
      if(function_exists($ftable[$i]))
               printf("'%s' is installed\n", $ftable[$i]);
       else
               printf("'%s' not installed*********\n", $ftable[$i]);
 }
 //echo PHP_VERSION;
 if (PHP_VERSION < '5.3.0') {
  printf("openssl_encrypt function is not executed under php 5.3\n");
  exit();
 }
 $string = "1234567890ABCDeFGHIJ";
       $pass = "1234";
       $method = "aes128";
       printf("Plain = %s\n", $string);
       
       $encrypted = openssl_encrypt($string, $method, $pass);
       
       printf("encrypted[%d]=%s\n", strlen($encrypted), md5($encrypted));
       
       $decrypted = openssl_decrypt($encrypted, $method, $pass);
       printf("decrypted[%d]=%s\n", strlen($decrypted), $decrypted);
       
       exit();

?>

1 php의 위치

명령어
which php
실행 예시
[root@zetawiki ~]# which php
/usr/bin/php
→ php는 /usr/bin 에 있다.

2 php.ini의 위치

명령어
php --ini | grep php.ini
실행 예시
[root@zetawiki ~]# php --ini | grep php.ini
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
→ php.ini는 /etc 에 있다.

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}