0

I have installed Apache on my Raspberry Pi without incident. However, I cannot install PHP correctly after having tried various methods. It appears to have installed but I cannot get PHP to output. I started with the well known tutorials here and others which describe the same steps. If I type php -v I get the following output:

PHP 5.6.30-0+deb8u1 (cli) (built: Apr 14 2017 16:20:58) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

More importantly, running apt-get update now gives me lots of errors such as:

Err http://repozytorium.mati75.eu jessie-backports/main armhf Packages                           
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/contrib armhf Packages                        
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/non-free armhf Packages                       
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/contrib Translation-en_GB                     
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/contrib Translation-en                        
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/main Translation-en_GB                        
  Bad header line [IP: 212.129.7.250 80]
Err http://repozytorium.mati75.eu jessie-backports/main Translation-en
  Bad header line [IP: 212.129.7.250 80]

and then further down:

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/main/binary-armhf/Packages  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/contrib/binary-armhf/Packages  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/non-free/binary-armhf/Packages  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/contrib/i18n/Translation-en_GB  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/contrib/i18n/Translation-en  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/main/i18n/Translation-en_GB  Bad header line [IP: 212.129.7.250 80]

W: Failed to fetch http://repozytorium.mati75.eu/raspbian/dists/jessie-backports/main/i18n/Translation-en  Bad header line [IP: 212.129.7.250 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

In the course of my PHP installation, I had to add the references to repozytorium.mati75.eu and that's a big part of the problem apparently. My sources.list looks like this:

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free

#deb-src http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free

What am I doing wrong and how can I fix it?

  • I have never heard of this "well known tutorial", which the author admits needs updating. If you installed Apache (you don't say how) it probably setup php5 (which is the default for Jessie). Unless you have some pressing need to use php7 I would stick with php5, although you would be better to switch to Stretch (Jessie is no longer supported) which uses the Debain default of php7. If you REALLY want to stick with Jessie AND use php7, you probably need to delete php5 first. – Milliways Oct 20 '17 at 4:27
  • I am ok with php 5. Isn't that what I have? I did try php7 when I had the above problems but it failed AFAIK. – Chiwda Oct 20 '17 at 5:21
  • P.S. The specific tutorial may not be well-known but at least half a dozen of the top ten google hits are identical tutorials, so in a generic sense they are well-known. If there is a better one and more recent, I would love to know about it, please. – Chiwda Oct 20 '17 at 5:23
  • 1
    All the errors you listed seem to be to that 3rd party tutorial. The Foundation tutorial (which hasn't been updated for Stretch/php7) works on Jessie. If you aren't trying to install php7, it is unclear exactly what your question is. – Milliways Oct 20 '17 at 5:35
  • The question is why doesn't php work? When I open a php file from the Pi in a browser I just get the text of the file, whereas an html file works fine. – Chiwda Oct 20 '17 at 5:58
2

Switch from http to https in the /etc/apt/sources.list:

deb https://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free
  • That appears to do it! I no longer see any errors in apt-get update/upgrade. Thanx! – Chiwda Oct 25 '17 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.