Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Tôi vừa cài đặt máy chủ PHP và Apache trên Ubuntu 17.04 nhưng tệp

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
4 của tôi không hoạt động trên trình duyệt của tôi.

index.php:




Welcome!

Chỉ

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
5 xuất hiện trên trình duyệt và khi tôi kiểm tra trang, tôi thấy mã PHP đang được nhận xét. Tôi đã bắt đầu Apache Server và vẫn không biết điều gì là sai. Xin hãy giúp tôi, cảm ơn bạn!

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
6

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
7

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

Tôi vừa cài đặt lại Apache và PHP5 nhưng khi tôi truy cập Root doc của mình, nó chỉ tải xuống một tệp "tải xuống". Và khi tôi dùng thử documentroot/index.php, nó chỉ tải xuống tệp PHP.

Tôi đã cài đặt PHP nhưng Apache dường như không muốn thực hiện nó. Mọi người đề nghị thêm dòng 'mô -đun tải' vào

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
8 của tôi nhưng tôi không có tệp đó.
People suggested adding a 'Load Module' line to my
apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
8 but I don't have that file.

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Thunderbird

1.90513 Huy hiệu vàng19 Huy hiệu bạc31 Huy hiệu đồng13 gold badges19 silver badges31 bronze badges

Hỏi ngày 20 tháng 4 năm 2014 lúc 23:46Apr 20, 2014 at 23:46

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Typing:

sudo apt-get install apache2 php5 libapache2-mod-php5

Sẽ cài đặt mọi thứ bạn cần và sẽ khởi động máy chủ Apache với sự hỗ trợ cho PHP.

Để xác minh rằng mô -đun PHP được tải, loại:

a2query -m php5

Nếu không được bật, sau đó tải với:

sudo a2enmod php5

và khởi động lại Apache:

sudo service apache2 restart

Cập nhật cho Php7.x (được thử nghiệm trên Ubuntu 16.04, 16.10, 18.04, 18.10))

Nhờ các ý kiến, tôi cập nhật câu trả lời cho php7.x.

Install:

sudo apt-get install apache2 php7.x libapache2-mod-php7.x 

Verify:

a2query -m php7.x

Load:

sudo a2enmod php7.x

Khởi động lại Apache:

sudo service apache2 restart

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Đã trả lời ngày 21 tháng 4 năm 2014 lúc 1:02Apr 21, 2014 at 1:02

Girardengogirardengogirardengo

4,8751 Huy hiệu vàng25 Huy hiệu bạc31 Huy hiệu đồng1 gold badge25 silver badges31 bronze badges

10

Một nguyên nhân phổ biến khác là các thẻ ngắn PHP

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
9 không được bật bởi cấu hình PHP.ini mặc định, vì vậy sau khi nâng cấp hoặc cài đặt lại, cài đặt đó có thể bị tắt và mã PHP có thể phụ thuộc vào nó. Hãy thử thay thế
apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
9 bằng
sudo apt-get install apache2 php5 libapache2-mod-php5
1.

(Credit)

Đã trả lời ngày 15 tháng 4 năm 2015 lúc 13:48Apr 15, 2015 at 13:48

Tufelkindertufelkindertufelkinder

3012 Huy hiệu bạc3 Huy hiệu đồng2 silver badges3 bronze badges

Ubuntu 16.04 đã chuyển sang PHP 7. Lệnh duy nhất này sẽ thực hiện công việc cho bạn: has moved to PHP 7. This single command will do the job for you:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
1

Ở đây

sudo apt-get install apache2 php5 libapache2-mod-php5
2 là một gói meta cài đặt libapache2-mod-php7.

Đã trả lời ngày 16 tháng 10 năm 2016 lúc 7:47Oct 16, 2016 at 7:47

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

daltonfury42daltonfury42daltonfury42

5.3595 Huy hiệu vàng29 Huy hiệu bạc62 Huy hiệu Đồng5 gold badges29 silver badges62 bronze badges

Tôi đã gặp phải vấn đề tương tự, nhưng vấn đề cụ thể của tôi là duy nhất. Tôi đã chạy trong một thư mục người dùng (sử dụng mod_userdir) - có nghĩa là bạn truy cập trang web của tôi bằng http://host.name.com/~username/example.php

Điều này bị vô hiệu hóa theo mặc định trong PHP*.conf trong thư mục hỗ trợ mod của tôi. Tôi đã phải sửa đổi nó để nhận xét nó ra:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
2

Đó là một nỗi đau để tìm ra ..

Chà, tôi nghi ngờ bất cứ ai có vấn đề đặc biệt này, nhưng tôi nghĩ rằng tôi sẽ thêm nó bởi vì nó gây bối rối cho tôi và có lẽ ai đó đang làm điều tương tự. Không ai sử dụng ~/người dùng nữa Tôi đoán, ngoại trừ tôi.

Bạn phải khởi động lại Apache sau tất nhiên.

Đã trả lời ngày 1 tháng 8 năm 2019 lúc 2:30Aug 1, 2019 at 2:30

1

Đối với những người đã tìm thấy bài đăng này từ Google gần 6 năm trong tương lai (và hơn thế nữa!), Bạn có thể gặp phải vấn đề này với Apache 2 và Php 7 trong khi cũng sử dụng mô -đun

sudo apt-get install apache2 php5 libapache2-mod-php5
3.

Một nguyên nhân khác có thể của vấn đề này có thể là bạn đang cố gắng chạy tập lệnh trong "thư mục người dùng" từ mô -đun

sudo apt-get install apache2 php5 libapache2-mod-php5
3. Chạy tập lệnh PHP trong thư mục người dùng bị vô hiệu hóa theo mặc định. Bạn sẽ gặp phải vấn đề này nếu tập lệnh nằm trong thư mục
sudo apt-get install apache2 php5 libapache2-mod-php5
5 trong thư mục nhà của bạn và bạn đang cố gắng truy cập nó từ
sudo apt-get install apache2 php5 libapache2-mod-php5
6.

Để khắc phục điều này, hãy mở ra

sudo apt-get install apache2 php5 libapache2-mod-php5
7. Bạn phải bình luận hoặc xóa khối thẻ ở phía dưới đọc

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
3

Đã trả lời ngày 30 tháng 3 năm 2020 lúc 4:14Mar 30, 2020 at 4:14

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Mở

sudo apt-get install apache2 php5 libapache2-mod-php5
8 với
sudo apt-get install apache2 php5 libapache2-mod-php5
9 trong thiết bị đầu cuối:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
4

Sau đó thay đổi:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
5

đến

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
6

Sau đó lưu và sau đó khởi động lại Apache2:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
7

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

Benny

4.6322 Huy hiệu vàng17 Huy hiệu bạc33 Huy hiệu đồng2 gold badges17 silver badges33 bronze badges

Đã trả lời ngày 29 tháng 9 năm 2017 lúc 4:52Sep 29, 2017 at 4:52

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

1

Trường hợp của tôi là một chút khác biệt. Tôi đã nâng cấp từ Ubuntu 19.04 lên 19.10. Trong khi nâng cao, nó đã cài đặt Php 7.3 (trong đó AS khi PHP 7.2 đã được cài đặt). Với 2 phiên bản được cài đặt A2Query -M Php7.3 Trả về không có mô -đun phù hợp với PHP7.3.a2query -m php7.3 return No module matches php7.3.

Giải pháp tôi tìm thấy là từ cách cài đặt-php-7-3-on-ubuntu.

Để đặt Php 7.0 làm mặc định, hãy chạy

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
8

Để đặt Php 7.2 làm mặc định, hãy chạy

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
9

Để đặt Php 7.3 làm mặc định, hãy chạy

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
0

Trước khi chúng tôi có thể định cấu hình Apache để sử dụng Php 7.3, chúng tôi cần tắt phiên bản cũ của Php 7.0 bằng cách nhập

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
1

Bây giờ hãy bật phiên bản Php 7.3 mới được cài đặt với lệnh sau:

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since Tue 2017-04-25 14:38:55 +07; 10min ago
  Process: 11578 ExecStop=/usr/sbin/apachectl stop (code=exited, status=0/SUCCESS)
  Process: 11604 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 11619 (apache2)
    Tasks: 55 (limit: 4915)
   Memory: 9.7M
      CPU: 429ms
   CGroup: /system.slice/apache2.service
           ├─11619 /usr/sbin/apache2 -k start
           ├─11663 /usr/sbin/apache2 -k start
           └─11664 /usr/sbin/apache2 -k start

Apr 25 14:38:55 g5080 systemd[1]: Starting The Apache HTTP Server...
Apr 25 14:38:55 g5080 apachectl[11604]: AH00558: apache2: Could not reliably determin…sage
Apr 25 14:38:55 g5080 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
2

Khởi động lại máy chủ web Apache để các thay đổi có hiệu lực:

PHP 7.0.15-1ubuntu4 (cli) (built: Feb 28 2017 21:33:59) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.15-1ubuntu4, Copyright (c) 1999-2017, by Zend Technologies
7

Đã trả lời ngày 29 tháng 10 năm 2019 lúc 11:15Oct 29, 2019 at 11:15

Hướng dẫn php not working in ubuntu - php không hoạt động trong Ubuntu

1

Tại sao trang PHP của tôi không hoạt động?

Lý do phổ biến nhất cho một trang trống là tập lệnh bị thiếu một ký tự. Nếu bạn bỏ ra một 'hoặc} hoặc; Ở đâu đó, PHP của bạn sẽ không hoạt động. Bạn không gặp lỗi; Bạn chỉ cần nhận được một màn hình trống.the script is missing a character. If you left out a ' or } or ; somewhere, your PHP won't work. You don't get an error; you just get a blank screen.

PHP ở Ubuntu ở đâu?

Vị trí mặc định cho PHP.Tệp INI là: Ubuntu 16.04: /etc/php/7.0/apache2.Centos 7: /etc /php./etc/php/7.0/apache2. CentOS 7: /etc/php.

Làm thế nào tôi có thể sử dụng PHP trong ubuntu?

Cài đặt PHP trên các hệ thống Ubuntu khá đơn giản.Bạn chỉ cần thêm PPA cần thiết và bạn có thể cài đặt bất kỳ phiên bản PHP nào trên hệ thống Ubuntu.Thêm PPA ondrej vào hệ thống của bạn, trong đó chứa tất cả các phiên bản của các gói PHP cho các hệ thống Ubuntu.Bây giờ, hãy cập nhật bộ nhớ cache của Trình quản lý gói APT.add the required PPA and you can install any PHP version on the Ubuntu system. Add the Ondrej PPA to your system, which contains all versions of PHP packages for the Ubuntu systems. Now, update the Apt package manager cache.

Php có được cài đặt theo mặc định trên Ubuntu không?

Lưu ý: Các tàu Ubuntu 20.04 có Php 7.4 trong kho lưu trữ ngược dòng của nó.Điều này có nghĩa là nếu bạn cố gắng cài đặt PHP mà không có phiên bản được chỉ định, nó sẽ sử dụng 7.4.Bạn sẽ muốn tránh dựa vào phiên bản mặc định của PHP vì phiên bản mặc định đó có thể thay đổi tùy thuộc vào nơi bạn đang chạy mã của mình.Ubuntu 20.04 ships with PHP 7.4 in its upstream repositories. This means that if you attempt to install PHP without a specified version, it will use 7.4. You will want to avoid relying on the default version of PHP because that default version could change depending on where you are running your code.