Php 8.0 삭제 - Php 8.0 sagje

First check your current version on mac. Please enter below command in your terminal.

Ex :- php -v
Output : PHP 7.1.2

Enter next command for uninstall the PHP on your system.

Ex :- brew uninstall

After select new version as you want to install, Please enter below command in your terminal.

Ex :- brew install

If you want to used in your valet system, Then please enter below command.

Ex :- valet use

After check your php version, Your php version updated in your system.

1. session 생성

session_start() 로 세션을 생성 할수 있습니다.
$_SESSION['name'] = '';
세션의 변수를 지정하는 문법입니다.

예제

<?php 

session_start();

$_SESSION['id'] = 'coffee';
$_SESSION['password'] = '1111';

echo $_SESSION['id'];
echo $_SESSION['password'];

?>

브라우저로 실행하면 아래와 같이 출력됩니다.

Php 8.0 삭제 - Php 8.0 sagje

Php 8.0 삭제 - Php 8.0 sagje

PHP 세션은 위 그림과 같이 PHPSESSID 라는 이름으로 저장됩니다.
맥(OS) 경우
/Applications/mampstack-8.0.19-0/php/tmp
에서 value의 이름으로 저장된걸 확인할수 있습니다.

Php 8.0 삭제 - Php 8.0 sagje

열어서 보시면 세션 변수로 지정한 값들을 확인 할수 있습니다.

2. session 삭제

session_destroy() 로 삭제를 합니다.
변수 해제의 경우 unset()를 사용하여 변수를 해제할수 있습니다.
물론 session_destroy() 를 사용하면 모두 지워집니다.

<?php 

unset($_SESSION['id']);

session_destroy();

?>

2018-01-25 23:39:32

수업소개

변경사항

index.php

<?php
function print_title(){
  if(isset($_GET['id'])){
    echo $_GET['id'];
  } else {
    echo "Welcome";
  }
}
function print_description(){
  if(isset($_GET['id'])){
    echo file_get_contents("data/".$_GET['id']);
  } else {
    echo "Hello, PHP";
  }
}
function print_list(){
  $list = scandir('./data');
  $i = 0;
  while($i < count($list)){
    if($list[$i] != '.') {
      if($list[$i] != '..') {
        echo "<li><a href=\"index.php?id=$list[$i]\">$list[$i]</a></li>\n";
      }
    }
    $i = $i + 1;
  }
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>
      <?php
      print_title();
      ?>
    </title>
  </head>
  <body>
    <h2><a href="index.php">WEB</a></h2>
    <ol>
      <?php
      print_list();
      ?>
    </ol>
    <a href="create.php">create</a>
    <?php if(isset($_GET['id'])) { ?>
      <a href="update.php?id=<?=$_GET['id']?>">update</a>
      <form action="delete_process.php" method="post">
        <input type="hidden" name="id" value="<?=$_GET['id']?>">
        <input type="submit" value="delete">
      </form>
    <?php } ?>
    <h2>
      <?php
      print_title();
      ?>
    </h2>
    <?php
    print_description();
     ?>
  </body>
</html>

delete_process.php

<?php
unlink('data/'.$_POST['id']);
header('Location: /index.php');
?>

1)php 및 모듈 확인

rpm -qa php 

rpm -qa | grep php

2)완전삭제

yum -y remove php*

3)

먼저 epel-releaseyum 저장소를 추가한다 

yum install epel-release

운영체제 버전에 맞는 remi-release 설치

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

(centos8) sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

yum --enablerepo=remi-php72 install php

yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-mysql php-bcmath php-gd php-mysqlnd php-pear php-process php-devel php-json php-opcache php-pdo