Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that php cannot be installed in raspberry pie?

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to solve the problem that php cannot be installed in raspberry pie". In daily operation, I believe that many people have doubts about how to solve the problem that raspberry pie cannot install php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt that "raspberry pie can not install php". Next, please follow the editor to study!

Raspberry pie can not install php solutions: 1, replace php7.0 with 7.3 apt 2, add apt sources, update the package list; 3, install PHP7.3.

This article operating environment: Raspbian system, PHP7.3, raspberry pie 4B.

What if php cannot be installed in raspberry pie? Raspberry pie failed to install php?

Recently, when I was studying raspberry pie in bilibili, I watched Mr. Han's video and found that I couldn't install php7.0.

After inquiry, it is found that php has been updated to 7.3. of course, the domestic source has also been updated, so you can not download the old version. When you watch the video, you just need to change from 7.0to 7.3.When you watch the video, you just need to change it from 7.0to 7.3.When you watch the video, you just need to change it from 7.0to 7.3.When you watch the video, you just need to change it.

Install PHP 7.3 + Nginx + Mariadb on raspberry pie 4B

Install PHP 7.3

Add an apt feed. Edit the apt source profile:

Sudo vi / etc/apt/sources.list.d/raspi.list

Add a line at the end:

Deb http://mirrordirector.raspbian.org/raspbian/ buster main contrib non-free rpi

Update the package list:

Sudo apt update

Install PHP7.3:

Sudo apt install-y-t buster php7.3-fpm php7.3-curl php7.3-gd php7.3-intl php7.3-mbstring php7.3-mysql php7.3-imap php7.3-opcache php7.3-sqlite3 php7.3-xml php7.3-xmlrpc php7.3-zip

During the installation process, you will be prompted that some services need to be restarted. Select Yes.

Test whether the installation is successful:

Php-v if the php version number is displayed, the installation is successful as follows: PHP 7.3.2-3 (cli) (built: Feb 8 2019 15:05:54) (NTS) Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologieswith Zend OPcache v7.3.2-3, Copyright (c) 1999-2018, by Zend Technologies

Install Nginx

Install nginx:

Sudo apt-get install nginx

After the installation, the root directory of the website is in / var/www/html. Edit the index.nginx-debian.html file in this directory and write to Hello, Nginx!.

Test whether the installation is successful: open the browser and type http://127.0.0.1, and you can see the Hello, Nginx! Indicates that the installation was successful. Or use the command line: curl 127.0.0.1, or you can output Hello, Nginx!.

Configure Nginx to resolve PHP

Edit the Nginx configuration file sudo vi / etc/nginx/sites-enabled/default, find # pass PHP scripts to FastCGI server, and add the following code after it:

Location ~\ .php$ {include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.3-fpm.sock;}

Then add index.php after the index directive, and the modified file content is as follows:

After modifying the configuration, you need to reload the Nginx configuration to take effect:

Sudo nginx-s reload

Test parsing PHP. Create a file / var/www/html/index.php and write the php code:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report