のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

apache error 500

$ clear
$ pwd
/var/log
$ cd /var/log/httpd
-bash: cd: /var/log/httpd: Permission denied
$ sudo cd /var/log/httpd
$ ls -al
total 292
drwxr-xr-x   8 root   root               333 Mar 31 06:38 .
drwxr-xr-x  20 root   root               280 Mar 31 06:38 ..
drwx------   2 root   root                41 Mar 31 06:39 httpd
$ ls -al ./httpd
ls: cannot open directory ./httpd: Permission denied
$ sudo ls -al ./httpd
total 24
drwx------ 2 root root   41 Mar 31 06:39 .
drwxr-xr-x 8 root root  333 Mar 31 06:38 ..
-rw-r--r-- 1 root root 9602 Mar 31 07:43 access_log
-rw-r--r-- 1 root root 9911 Mar 31 07:43 error_log
$ sudo tail ./httpd/access_log
14.11.162.128 - - [31/Mar/2021:07:43:46 +0000] "GET /sum.php HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
$ sudo tail ./httpd/error_log
[Wed Mar 31 07:43:46.320138 2021] [:error] [pid 4364] [client 14.11.162.128:28542] 
PHP Parse error:  syntax error, unexpected '>',
 expecting variable (T_VARIABLE) or '$' 
in /var/www/html/sum.php on line 4
$ sudo vim sum.php
<?php
$sum = 10+1;
echo $sum;
$>

?と$を間違えていた。

$ sudo vim sum.php
<?php
$sum = 10+1;
echo $sum;
?>