Raspberry Pi – Software – Apache webserver + PHP
apache webserver
Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages.
On its own, Apache can serve HTML files over HTTP, and with additional modules can serve dynamic web pages using scripting languages such as PHP.
sudo apt-get -y install apache2 php libapache2-mod-php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: fonts-font-awesome geoclue-2.0 golang-1.11-go golang-1.11-src golang-go golang-src grafana-data iio-sensor-proxy libjs-angularjs libjs-jquery-metadata libjs-jquery-tablesorter libjs-twitter-bootstrap libmbim-glib4 libmbim-proxy libmm-glib0 libqmi-glib5 libqmi-proxy libqt5positioning5 libqt5qml5 libqt5quick5 libqt5sensors5 libqt5webchannel5 libqt5webkit5 modemmanager phantomjs Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: apache2-bin apache2-data apache2-utils libapache2-mod-php7.3 libaprutil1-dbd-sqlite3 libaprutil1-ldap php-common php7.3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline ssl-cert Suggested packages: apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear openssl-blacklist The following NEW packages will be installed: apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php libapache2-mod-php7.3 libaprutil1-dbd-sqlite3 libaprutil1-ldap php php-common php7.3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-readline ssl-cert 0 upgraded, 17 newly installed, 0 to remove and 165 not upgraded. Need to get 4,806 kB of archives. After this operation, 19.8 MB of additional disk space will be used. Get:1 http://mirror.transip.net/raspbian/raspbian buster/main armhf libaprutil1-dbd-sqlite3 armhf 1.6.1-4 [17.3 kB] Get:2 http://mirror.transip.net/raspbian/raspbian buster/main armhf libaprutil1-ldap armhf 1.6.1-4 [16.3 kB] Get:3 http://mirror.transip.net/raspbian/raspbian buster/main armhf apache2-bin armhf 2.4.38-3+deb10u4 [1,119 kB] Get:4 http://mirror.transip.net/raspbian/raspbian buster/main armhf apache2-data all 2.4.38-3+deb10u4 [165 kB] Get:5 http://mirror.transip.net/raspbian/raspbian buster/main armhf apache2-utils armhf 2.4.38-3+deb10u4 [235 kB] Get:6 http://mirror.transip.net/raspbian/raspbian buster/main armhf apache2 armhf 2.4.38-3+deb10u4 [251 kB] Get:7 http://mirror.transip.net/raspbian/raspbian buster/main armhf php-common all 2:69 [15.0 kB] Get:8 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3-common armhf 7.3.19-1~deb10u1 [522 kB] Get:9 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3-json armhf 7.3.19-1~deb10u1 [16.2 kB] Get:10 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3-opcache armhf 7.3.19-1~deb10u1 [153 kB] Get:11 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3-readline armhf 7.3.19-1~deb10u1 [10.7 kB] Get:12 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3-cli armhf 7.3.19-1~deb10u1 [1,124 kB] Get:13 http://mirror.transip.net/raspbian/raspbian buster/main armhf libapache2-mod-php7.3 armhf 7.3.19-1~deb10u1 [1,083 kB] Get:14 http://mirror.transip.net/raspbian/raspbian buster/main armhf libapache2-mod-php all 2:7.3+69 [6,120 B] Get:15 http://mirror.transip.net/raspbian/raspbian buster/main armhf php7.3 all 7.3.19-1~deb10u1 [43.4 kB] Get:16 http://mirror.transip.net/raspbian/raspbian buster/main armhf php all 2:7.3+69 [5,964 B] Get:17 http://mirror.transip.net/raspbian/raspbian buster/main armhf ssl-cert all 1.0.39 [20.8 kB] Fetched 4,806 kB in 14s (351 kB/s) Preconfiguring packages ... Selecting previously unselected package libaprutil1-dbd-sqlite3:armhf. (Reading database ... 166317 files and directories currently installed.) Preparing to unpack .../00-libaprutil1-dbd-sqlite3_1.6.1-4_armhf.deb ... Unpacking libaprutil1-dbd-sqlite3:armhf (1.6.1-4) ... Selecting previously unselected package libaprutil1-ldap:armhf. Preparing to unpack .../01-libaprutil1-ldap_1.6.1-4_armhf.deb ... Unpacking libaprutil1-ldap:armhf (1.6.1-4) ... Selecting previously unselected package apache2-bin. Preparing to unpack .../02-apache2-bin_2.4.38-3+deb10u4_armhf.deb ... Unpacking apache2-bin (2.4.38-3+deb10u4) ... Selecting previously unselected package apache2-data. Preparing to unpack .../03-apache2-data_2.4.38-3+deb10u4_all.deb ... Unpacking apache2-data (2.4.38-3+deb10u4) ... Selecting previously unselected package apache2-utils. Preparing to unpack .../04-apache2-utils_2.4.38-3+deb10u4_armhf.deb ... Unpacking apache2-utils (2.4.38-3+deb10u4) ... Selecting previously unselected package apache2. Preparing to unpack .../05-apache2_2.4.38-3+deb10u4_armhf.deb ... Unpacking apache2 (2.4.38-3+deb10u4) ... Selecting previously unselected package php-common. Preparing to unpack .../06-php-common_2%3a69_all.deb ... Unpacking php-common (2:69) ... Selecting previously unselected package php7.3-common. Preparing to unpack .../07-php7.3-common_7.3.19-1~deb10u1_armhf.deb ... Unpacking php7.3-common (7.3.19-1~deb10u1) ... Selecting previously unselected package php7.3-json. Preparing to unpack .../08-php7.3-json_7.3.19-1~deb10u1_armhf.deb ... Unpacking php7.3-json (7.3.19-1~deb10u1) ... Selecting previously unselected package php7.3-opcache. Preparing to unpack .../09-php7.3-opcache_7.3.19-1~deb10u1_armhf.deb ... Unpacking php7.3-opcache (7.3.19-1~deb10u1) ... Selecting previously unselected package php7.3-readline. Preparing to unpack .../10-php7.3-readline_7.3.19-1~deb10u1_armhf.deb ... Unpacking php7.3-readline (7.3.19-1~deb10u1) ... Selecting previously unselected package php7.3-cli. Preparing to unpack .../11-php7.3-cli_7.3.19-1~deb10u1_armhf.deb ... Unpacking php7.3-cli (7.3.19-1~deb10u1) ... Selecting previously unselected package libapache2-mod-php7.3. Preparing to unpack .../12-libapache2-mod-php7.3_7.3.19-1~deb10u1_armhf.deb ... Unpacking libapache2-mod-php7.3 (7.3.19-1~deb10u1) ... Selecting previously unselected package libapache2-mod-php. Preparing to unpack .../13-libapache2-mod-php_2%3a7.3+69_all.deb ... Unpacking libapache2-mod-php (2:7.3+69) ... Selecting previously unselected package php7.3. Preparing to unpack .../14-php7.3_7.3.19-1~deb10u1_all.deb ... Unpacking php7.3 (7.3.19-1~deb10u1) ... Selecting previously unselected package php. Preparing to unpack .../15-php_2%3a7.3+69_all.deb ... Unpacking php (2:7.3+69) ... Selecting previously unselected package ssl-cert. Preparing to unpack .../16-ssl-cert_1.0.39_all.deb ... Unpacking ssl-cert (1.0.39) ... Setting up php-common (2:69) ... Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer. Setting up libaprutil1-ldap:armhf (1.6.1-4) ... Setting up libaprutil1-dbd-sqlite3:armhf (1.6.1-4) ... Setting up php7.3-common (7.3.19-1~deb10u1) ... Creating config file /etc/php/7.3/mods-available/calendar.ini with new version Creating config file /etc/php/7.3/mods-available/ctype.ini with new version Creating config file /etc/php/7.3/mods-available/exif.ini with new version Creating config file /etc/php/7.3/mods-available/fileinfo.ini with new version Creating config file /etc/php/7.3/mods-available/ftp.ini with new version Creating config file /etc/php/7.3/mods-available/gettext.ini with new version Creating config file /etc/php/7.3/mods-available/iconv.ini with new version Creating config file /etc/php/7.3/mods-available/pdo.ini with new version Creating config file /etc/php/7.3/mods-available/phar.ini with new version Creating config file /etc/php/7.3/mods-available/posix.ini with new version Creating config file /etc/php/7.3/mods-available/shmop.ini with new version Creating config file /etc/php/7.3/mods-available/sockets.ini with new version Creating config file /etc/php/7.3/mods-available/sysvmsg.ini with new version Creating config file /etc/php/7.3/mods-available/sysvsem.ini with new version Creating config file /etc/php/7.3/mods-available/sysvshm.ini with new version Creating config file /etc/php/7.3/mods-available/tokenizer.ini with new version Setting up ssl-cert (1.0.39) ... Setting up php7.3-opcache (7.3.19-1~deb10u1) ... Creating config file /etc/php/7.3/mods-available/opcache.ini with new version Setting up apache2-data (2.4.38-3+deb10u4) ... Setting up apache2-utils (2.4.38-3+deb10u4) ... Setting up php7.3-json (7.3.19-1~deb10u1) ... Creating config file /etc/php/7.3/mods-available/json.ini with new version Setting up php7.3-readline (7.3.19-1~deb10u1) ... Creating config file /etc/php/7.3/mods-available/readline.ini with new version Setting up apache2-bin (2.4.38-3+deb10u4) ... Setting up php7.3-cli (7.3.19-1~deb10u1) ... update-alternatives: using /usr/bin/php7.3 to provide /usr/bin/php (php) in auto mode update-alternatives: using /usr/bin/phar7.3 to provide /usr/bin/phar (phar) in auto mode update-alternatives: using /usr/bin/phar.phar7.3 to provide /usr/bin/phar.phar (phar.phar) in auto mode Creating config file /etc/php/7.3/cli/php.ini with new version Setting up apache2 (2.4.38-3+deb10u4) ... Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. Enabling module auth_basic. Enabling module access_compat. Enabling module authn_file. Enabling module authz_user. Enabling module alias. Enabling module dir. Enabling module autoindex. Enabling module env. Enabling module mime. Enabling module negotiation. Enabling module setenvif. Enabling module filter. Enabling module deflate. Enabling module status. Enabling module reqtimeout. Enabling conf charset. Enabling conf localized-error-pages. Enabling conf other-vhosts-access-log. Enabling conf security. Enabling conf serve-cgi-bin. Enabling site 000-default. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service. Setting up libapache2-mod-php7.3 (7.3.19-1~deb10u1) ... Creating config file /etc/php/7.3/apache2/php.ini with new version Module mpm_event disabled. Enabling module mpm_prefork. apache2_switch_mpm Switch to prefork apache2_invoke: Enable module php7.3 Setting up libapache2-mod-php (2:7.3+69) ... Setting up php7.3 (7.3.19-1~deb10u1) ... Setting up php (2:7.3+69) ... Processing triggers for man-db (2.8.5-2) ... Processing triggers for systemd (241-7~deb10u4+rpi1) ... |
After install and visiting the raspberry pi’s IP:
Grant access to edit and delete files:
1 2 |
sudo chmod -R 777 /var/www sudo chown -R pi /var/www |