0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

aws lightsail phpのバージョンを変更

0
Last updated at Posted at 2023-04-12

参考
https://qiita.com/hamburg-love/items/3aecc7753e36013f874c
https://www.konosumi.net/entry/2023/01/22/204340

php8.2あるか確認

amazon-linux-extras

うほっ!見つけたよぉ❤

68  php8.2            available      [ =stable ]

まずは古いphpをすべて削除

# 古いphpすべて削除 (これを先にやらないと古いphpが動いてしまう)
yum remove php*

# インスコ
sudo amazon-linux-extras install php8.2

# configファイルを探す
find / -name "*www.conf*" -print
vim /etc/php-fpm.d/www.conf



www.conf 変更

ESC 状態で:set numberと入力し、行番号を表示させておくと楽

###変更###
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm.sock

### 24行目あたり ###
# 変更前
user = apache
# 変更後
user = nginx

### 26行目あたり ###
# 変更前
group = apache
# 変更後
group = nginx

### 48行目あたり ###
# 変更前
;listen.owner = nobody
# 変更後
listen.owner = nginx

### 49行目あたり ###
# 変更前
;listen.group = nobody
# 変更後
listen.group = nginx

### 50行目あたり ###
# 変更前
;listen.mode = 0666
# 変更後
listen.mode = 0666

再起動してインスコ確認

systemctl restart php-fpm.service
sudo systemctl restart nginx
php -v

その他のものをインスコ

# redis をインスコ (このやり方をしないと入らない)
amazon-linux-extras enable epel
yum install epel-release
sudo yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum -y --enablerepo=remi-php82 install php-pear
pecl install redis
echo "extension=redis.so" >> /etc/php.ini

# その他もろもろ
sudo yum install php-mbstring php-pdo php-gd php-mysqlnd php-xml php-opcache php-fpm

# 再起動
systemctl restart php-fpm.service
sudo systemctl restart nginx

なんか色々エラーが出るので composer も update
とくに carbon 。。。

cd /var/www/html/yourdir
composer update nesbot/carbon
vim composer.json

いやーめちゃくちゃ簡単にインスコできますね。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?