jerome30
Posts: 5
Joined: Sun Sep 13, 2020 12:42 pm

raspberry for Apache Web Server (with older PHP version)

Sun Sep 13, 2020 12:51 pm

Hi

i bought a raspberry 4 to install apache web and simulate my website on the raspberry.
However my site was in php5 and during the installation of my new purchase, I am in php7.

Suddenly, all the hundreds of connection pages no longer work, I have to change my code and make a connection via PDO.
It is a Tytanic job and I will never see the end of it.

I still have the solution to force the installation on my raspberry with a PHP 5.4 version.
But I can't do it, I don't have the required skills.
I have reinstalled the system several times, but following the tutorials, APT INSTALL only installs the latest version of PHP, version 7.XX.
I downloaded well and tried to install an older PHP version with the MAKE, INSTALL ... functions and it does not work.
Have an idea to easily uninstall PHP 7 and install an older version like PHP 5.4 instead, in a beginner command line, like SUDO APT INSTALL PHP5.4 ...

thanks for your help

User avatar
DougieLawson
Posts: 40824
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 7:30 am

Rewrite your PHP to work with PHP7 (which may mean some tiny tweaks and especially if you use MySQL). That will be more than a million times less painful than trying to install PHP5 on Buster.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

jerome30
Posts: 5
Joined: Sun Sep 13, 2020 12:42 pm

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 9:50 am

you are right ... but the work seems huge on hundreds of files ... writing in PDO is indigestible !

I tried to install an old version of RASBIAN or force the installation of PHP5 manually .. it did not work well

thank you for your advice

User avatar
rpdom
Posts: 18149
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 11:03 am

jerome30 wrote:
Mon Sep 14, 2020 9:50 am
writing in PDO is indigestible
Try using mysqli instead. That is very similar to the old mysql functions.
Unreadable squiggle

jerome30
Posts: 5
Joined: Sun Sep 13, 2020 12:42 pm

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 6:02 pm

great idea, thanks rpdom

it seem work fine but i have strange bug :

all my requests which include limits, they only output one line!

example :

Code: Select all

    $affiche = "SELECT * FROM test ORDER BY date DESC LIMIT 0,10";
i have just 1 line now :shock:

any idea ? thanks

RaspiFanBoy
Posts: 17
Joined: Sun Aug 16, 2020 9:09 am

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 6:06 pm

How do you make a website? Can you help me?

User avatar
DougieLawson
Posts: 40824
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 6:12 pm

RaspiFanBoy wrote:
Mon Sep 14, 2020 6:06 pm
How do you make a website? Can you help me?
Follow the Raspberry Pi Foundation recipe for a Wordpress site at: https://projects.raspberrypi.org/en/pro ... -wordpress
That will get you a fully functional LAMP stack.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

jerome30
Posts: 5
Joined: Sun Sep 13, 2020 12:42 pm

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 6:14 pm

that's really easy (if your website works with php7 same the last wordpress version)


try this :

https://howtoraspberrypi.com/how-to-ins ... y-pi-lamp/

RaspiFanBoy
Posts: 17
Joined: Sun Aug 16, 2020 9:09 am

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 7:14 pm

DougieLawson wrote:
Mon Sep 14, 2020 6:12 pm
RaspiFanBoy wrote:
Mon Sep 14, 2020 6:06 pm
How do you make a website? Can you help me?
Follow the Raspberry Pi Foundation recipe for a Wordpress site at: https://projects.raspberrypi.org/en/pro ... -wordpress
That will get you a fully functional LAMP stack.
But can I design my site the way I want with wordpress? And if so, how?

Heater
Posts: 17424
Joined: Tue Jul 17, 2012 3:02 pm

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 7:34 pm

RaspiFanBoy wrote:
Mon Sep 14, 2020 7:14 pm
But can I design my site the way I want with wordpress? And if so, how?
What kind of web site do you have in mind?

Personally would never dream of using Wordpress to do what I want in a web site.

If you just want to serve up some static pages then by all means install the Apache web server or Nginx. Then start writing the HTML, CSS and Javascript you want on the pages. The internet is full of advice as to how to do this. For example https://www.w3schools.com/ and thousands of tutorials and blogs.

If you want some interactivity then it's time to look into using node.js for your web server and something like the React library for the browser side interface.

There are so many options. What do you actually want to do?
Memory in C++ is a leaky abstraction .

RaspiFanBoy
Posts: 17
Joined: Sun Aug 16, 2020 9:09 am

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 8:12 pm

Heater wrote:
Mon Sep 14, 2020 7:34 pm
RaspiFanBoy wrote:
Mon Sep 14, 2020 7:14 pm
But can I design my site the way I want with wordpress? And if so, how?
What kind of web site do you have in mind?

Personally would never dream of using Wordpress to do what I want in a web site.

If you just want to serve up some static pages then by all means install the Apache web server or Nginx. Then start writing the HTML, CSS and Javascript you want on the pages. The internet is full of advice as to how to do this. For example https://www.w3schools.com/ and thousands of tutorials and blogs.

If you want some interactivity then it's time to look into using node.js for your web server and something like the React library for the browser side interface.

There are so many options. What do you actually want to do?
I think a website like that about ireland in the projects. A simple. Or another. But my question is: Where can i code the website if i use this LAMP project

Heater
Posts: 17424
Joined: Tue Jul 17, 2012 3:02 pm

Re: raspberry for Apache Web Server (with older PHP version)

Mon Sep 14, 2020 8:50 pm

RaspiFanBoy wrote:
Mon Sep 14, 2020 8:12 pm
I think a website like that about ireland in the projects. A simple. Or another.
That makes no sense what so ever.
RaspiFanBoy wrote:
Mon Sep 14, 2020 8:12 pm
But my question is: Where can i code the website if i use this LAMP project
If you want to create a web server setup with Linux, Apache, MySql, PHP, (LAMP) then advice in the form of tutorials, blogs, documentation is all over the net. For example: https://www.mgcwebsites.co.uk/raspberry ... webserver/
Memory in C++ is a leaky abstraction .

RaspiFanBoy
Posts: 17
Joined: Sun Aug 16, 2020 9:09 am

Re: raspberry for Apache Web Server (with older PHP version)

Tue Sep 15, 2020 5:03 am

Heater wrote:
Mon Sep 14, 2020 8:50 pm
RaspiFanBoy wrote:
Mon Sep 14, 2020 8:12 pm
I think a website like that about ireland in the projects. A simple. Or another.
That makes no sense what so ever.
RaspiFanBoy wrote:
Mon Sep 14, 2020 8:12 pm
But my question is: Where can i code the website if i use this LAMP project
If you want to create a web server setup with Linux, Apache, MySql, PHP, (LAMP) then advice in the form of tutorials, blogs, documentation is all over the net. For example: https://www.mgcwebsites.co.uk/raspberry ... webserver/
But where i can code my website or make my website. There is no tutorial on where to code the website if i make a LAMP website. There are only themes or plugins. Or should i upload a website or something? Plss explain

jerome30
Posts: 5
Joined: Sun Sep 13, 2020 12:42 pm

Re: raspberry for Apache Web Server (with older PHP version)

Tue Sep 15, 2020 5:55 am

so when I do a simple request that includes the LIMIT function, this one is not taken into account, I only have one line.

I think the error could come from my loop with the WHILE function ?

or else I don't close the connection, I never use mysqli_chose ()

Heater
Posts: 17424
Joined: Tue Jul 17, 2012 3:02 pm

Re: raspberry for Apache Web Server (with older PHP version)

Tue Sep 15, 2020 6:45 am

RaspiFanBoy wrote:
Tue Sep 15, 2020 5:03 am
But where i can code my website or make my website. There is no tutorial on where to code the website if i make a LAMP website. There are only themes or plugins. Or should i upload a website or something? Plss explain
If you want to create a web server using Apache, PHP and MySql on a Raspberry Pi then follow the instructions to get everything installed here: https://www.raspberrypi.org/documentati ... /apache.md. But skip the last part about WordPress.

At that point you will have a web server running and you will have seen your first PHP code creating content you can view with your web browser.

Now you have a long road ahead:

1) You are going to need to know how to create web pages with HTML. See google for "html tutorial". This is a good start though: https://www.w3schools.com/html/

2) If you want your pages to look nice you are going to need to learn about Cascading Style Sheeets, CSS. See google again. w3schools also have good material on that: https://www.w3schools.com/css/

3) Most likely you will want to use Javascript in your web pages. w3schools again: https://www.w3schools.com/js/

4) And of course there is learning how to program in PHP: https://www.w3schools.com/php/DEFAULT.asp

5) Then there is that MySql data base thing: https://www.mysqltutorial.org/

All of the above is just the basics. But will get you started and point you in directions you might want to go in.

Of course as we are on the internet and this is all about web technology there are thousands of tutorials, blogs, youtube videos, etc about all these things just a google search away. Or there are even hundreds of real, good old fashioned books to be had.
Memory in C++ is a leaky abstraction .

Return to “General programming discussion”