[LINUX] I wondered if it became so easy when it became centos8 2 ~ I tried adding PHP ~

You wouldn't be surprised if the screen became a GUI! If you think about it, there are many other surprises.

1. Install php without permission!

I thought that php was not included, so I added php -v with half a prank. VirtualBox_phptest_25_06_2020_22_58_30.png It was as expected until "Command not found ...". What! After that, he asked me, "Do you want to install it?" I'm going to put in a "y". VirtualBox_phptest_25_06_2020_23_00_21.png Unu, a message that misleads people. This is the spirited "y"! VirtualBox_phptest_25_06_2020_23_01_27.png When asked for the administrator password, I'm a little withered. VirtualBox_phptest_25_06_2020_23_02_04.png It seems that something was done. Try putting php -v again. VirtualBox_phptest_25_06_2020_23_03_05.png It's done. seriously.

2. Install apache without permission!

Let's get on with it and set up apache as it is. Try entering httpd -v as in php. image.png Sure enough, I was asked if I would like to install it. image.png It seems that it will install quite a lot. Also put y in the spirit here. image.png The administrator password input screen appears, so try entering it. image.png It seems that it was installed. Try putting systemctl. image.png The status is displayed. It seems that they even registered the service. I will start it by the way. By the way, when exiting the command, enter q. image.png Administrator password. I'm asked a little. I should have done sushi. After entering the password, check the status. It is running properly. image.png When I launched FireFox of centos8 and accessed localhost, the top page of apache was displayed. Usha! VirtualBox_phptest_27_06_2020_14_06_06.png Set so that it can be viewed from the host PC. The firewall seems to be useless unless it is changed with a command. image.png Open http. image.png Now you can see centos8 apache from the host OS. image.png

3. Easy to run php with apache!

Try setting php in apache with this flow. I'd like to create phpinfo.php in / var / www / html for the time being. Since it's a big deal, let's make it with a text editor using GUI. Open the right menu in the activity and click on the application. VirtualBox_phptest_27_06_2020_15_30_16.png Click "All" below. VirtualBox_phptest_27_06_2020_15_31_00.png Only "Text ..." is displayed, but click this to open a text editor. VirtualBox_phptest_27_06_2020_15_31_53.png Prepare phpinfo with a text editor. VirtualBox_phptest_27_06_2020_15_34_01.png Save this as phpinfo.php in / var / www / html. VirtualBox_phptest_27_06_2020_15_34_15.png Click "+ Other location" to display frequently used folders on linux. VirtualBox_phptest_27_06_2020_15_36_05.png Click on computer VirtualBox_phptest_27_06_2020_15_37_35.png Various familiar folder names are displayed, so follow to / var / www / html. VirtualBox_phptest_27_06_2020_15_38_18.png Save as phpinfo.php. VirtualBox_phptest_27_06_2020_15_40_30.png I was told I wasn't authorized. Hey. VirtualBox_phptest_27_06_2020_15_41_21.png It can't be helped, so save it in your own folder. VirtualBox_phptest_27_06_2020_15_47_26.png Then copy it to / var / www / html with the command. If you think, you can't input Japanese. For the time being, after installing ibas, it can be installed. I referred to this site. Thank you very much. It may be better to restart after installing ibus. It's inconvenient for linux that you can't cd if you can't enter Japanese ... VirtualBox_phptest_27_06_2020_17_42_51.png Now you have phpinfo. For the time being, try accessing localhost / phpinfo.php with FireFox of centos8.

VirtualBox_phptest_27_06_2020_17_47_14.png

Well, that's right. I haven't done anything. Now let's put php in apache. I used to set the php module in httpd.conf, but it's different from centos8. If you run php-fpm, it will connect. What the hell is that? For the time being, try running php-fpm as it is said.

[root@localhost ~]# systemctl start php-fpm
Failed to start php-fpm.service: Unit php-fpm.service not found.

There isn't. Also try -v as usual.

[root@localhost ~]# php-fpm -v
bash: php-fpm:The command was not found...
Command php-fpm'Package to provide'php-fpm'Do you want to install? [N/y]

You see. y Let's go.

[root@localhost ~]# php-fpm -v
bash: php-fpm:The command was not found...
Command php-fpm'Package to provide'php-fpm'Do you want to install? [N/y] y


 *Waiting in the queue...
 *Loading the list of packages....
The following packages should be installed:
 nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch The basic directory layout for the Nginx server
 php-fpm-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64    PHP FastCGI Process Manager
Do you want to continue with the changes?

Okay, this is also y.

[root@localhost ~]# php-fpm -v
bash: php-fpm:The command was not found...
Command php-fpm'Package to provide'php-fpm'Do you want to install? [N/y] y


 *Waiting in the queue...
 *Loading the list of packages....
The following packages should be installed:
 nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch The basic directory layout for the Nginx server
 php-fpm-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64    PHP FastCGI Process Manager
Do you want to continue with the changes?[N/y] y


 *Waiting in the queue...
 *Waiting for certification...
 *Waiting in the queue...
 *Downloading package...
 *Requesting data...
 *Testing changes...
 *Installing the package...
PHP:  syntax error, unexpected '&' in /etc/php.ini on line 107
PHP 7.2.24 (fpm-fcgi) (built: Oct 22 2019 08:28:36)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

It is said that there is a syntax error, but I will start it for the time being.

[root@localhost ~]# systemctl start php-fpm
[root@localhost ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor pr>
   Active: active (running) since Sat 2020-06-27 08:47:16 EDT; 6s ago
 Main PID: 3415 (php-fpm)
   Status: "Ready to handle connections"
    Tasks: 6 (limit: 11324)
   Memory: 6.8M
   CGroup: /system.slice/php-fpm.service
           tq3415 php-fpm: master process (/etc/php-fpm.conf)
           tq3416 php-fpm: pool www
           tq3417 php-fpm: pool www
           tq3418 php-fpm: pool www
           tq3419 php-fpm: pool www
           mq3420 php-fpm: pool www

June 27 08:47:16 localhost.localdomain systemd[1]: Starting The PHP FastCGI Pro>
June 27 08:47:16 localhost.localdomain php-fpm[3415]: PHP:  syntax error, unexp>
June 27 08:47:16 localhost.localdomain systemd[1]: Started The PHP FastCGI Proc>

It seems to have moved. Try running httpd as well.

[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor pres>
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           mqphp-fpm.conf
   Active: active (running) since Sat 2020-06-27 08:49:03 EDT; 4s ago
     Docs: man:httpd.service(8)
 Main PID: 3747 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 11324)
   Memory: 21.5M
   CGroup: /system.slice/httpd.service
           tq3747 /usr/sbin/httpd -DFOREGROUND
           tq3748 /usr/sbin/httpd -DFOREGROUND
           tq3749 /usr/sbin/httpd -DFOREGROUND
           tq3750 /usr/sbin/httpd -DFOREGROUND
           mq3751 /usr/sbin/httpd -DFOREGROUND

June 27 08:49:03 localhost.localdomain systemd[1]: Starting The Apache HTTP Ser>
June 27 08:49:03 localhost.localdomain httpd[3747]: AH00558: httpd: Could not r>
June 27 08:49:03 localhost.localdomain systemd[1]: Started The Apache HTTP Serv>
June 27 08:49:03 localhost.localdomain httpd[3747]: Server configured, listenin>

It seems to have moved. Try accessing phpinfo again with FireFox in centos8. VirtualBox_phptest_27_06_2020_22_04_32.png It's done, it's done! I didn't write anything in the config file and php worked. Just in case, try accessing from the host OS as well. image.png I saw it. No, it's unusually easy compared to now, centos8! If this is the case, you can easily launch apache.

Recommended Posts

I wondered if it became so easy when it became centos8 2 ~ I tried adding PHP ~
Did it become so easy when it became centos8?
I wondered if Python 3.4 was faster, but it was slower
AWS Lambda now supports Python so I tried it
When I tried the AtCoder Beginner Contest, it was a terrible result, so I look back
I stumbled when I tried to install Basemap, so a memorandum
I want Airpods Pro, so I will notify LINE when it arrives
A memorandum when I tried to get it automatically with selenium