Announcement

Collapse
No announcement yet.

Need help installing LAMP stack for localhost use

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [RESOLVED] Need help installing LAMP stack for localhost use

    Using 20.04

    I'm trying to get the lamp-stack installed and configured for localhost use only so I can learn PHP. I'm going to use PhpStorm, since for me it's already paid for. I tried following Jetbrain's instructions but they don't seem to have been written with Linux in mind.

    I installed apache2 and php7.4 via Muon. I have not installed mysql yet.

    I have confirmed that the apache2 server is up an running at port 80.

    But when I try to run a .php file the browser just displays the script as it is written in the file.

    A google search turned up nothing useful to me.

    Can someone please explain the correct way to get apache2, php, and mysql installed and configured for localhost development?
    Last edited by TwoFistedJustice; Jun 18, 2022, 04:21 PM.

    #2
    Just a suggestion . . .
    I would just make sure to eliminate the script you are using as a test and the browser as the culprit:
    But when I try to run a .php file the browser just displays the script as it is written in the file.
    Just to make sure it is not an issue with the particular php script you are running, have you tried using the example test.php script in step 3 under Check PHP Installation? If not, try that as well to see if you still get the same issue.
    What browser are you using? Have you tried this in more than one browser? I would try it in a second browser to see whether or not you get the same issue. If you cannot repeat the issue with the test.php script and a different browser, you can likely know that the browser is not blocking the script and the php script is not faulty. Then it likely is that things didn't get set up correctly.
    Last edited by rab0171610; May 27, 2022, 02:13 AM.

    Comment


      #3
      Another friendly suggestion is to check out XAMPP which includes:
      XAMPP Apache + MariaDB + PHP + Perl

      What is XAMPP?

      XAMPP is the most popular PHP development environment

      XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.
      https://www.apachefriends.org/index.html
      You could see if you can get that setup and running easily. That may give you something to work with until you can troubleshoot your desired setup with mysql.
      Last edited by rab0171610; May 27, 2022, 02:25 AM.

      Comment


        #4
        Firstly, I copy and pasted Jetbrain's script.

        Originally posted by rab0171610 View Post
        Another friendly suggestion is to check out XAMPP which includes:
        XAMPP Apache + MariaDB + PHP + Perl
        As for XAMPP, seems like a good option. I don't need mysql specifically as long as the commands for MariaDB are the same, which they appear to be.

        Would I be well advised to remove apache2 and php7.4 from my system before proceeding? Or will it not matter?

        Comment


          #5
          That I do not know. I do not have any experience with either php nor XAMPP so I would hazard to guess uninstalling what you have installed might be the best option, then let XAMPP do its own thing.

          Comment


            #6
            I'm going to mark this solved and add some final notes for reference.

            My solution was to abandon all *AMP stacks in favor of using Docker for development.

            Docker basics

            https://r.je/vje-docker-virtual-server


            Setting Up a Modern PHP Development Environment with Docker
            Rather a long scroll, be careful not to miss a step.
            https://www.sitepoint.com/docker-php...t-environment/



            Install Mysql via apt-get rather than Muon

            For learning Mysql I needed to install mysql-server on my system (not via Docker). That was very problematic when installing via Muon. It just straight up refused to work without any meaningful error messages. My solution to that was to uninstall everything even remotely related to Mysql in Muon and then install Mysql via apt-get. Which worked first time out. I followed the instructions here:
            https://dev.mysql.com/doc/mysql-apt-...uick-guide/en/

            Comment


              #7
              I figured you would find a solution soon enough that would fit your needs.
              Very informative article. I didn't know any of that. After reading down to the "getting started" section, I am glad I am no longer in school and have no need to do any of that in my life these days. Comp-luh-cay-ted!!! Good luck with your adventures in PHP and thanks for the update on how things should be done in the present times with regards to setting up a web development environment. Great info!

              Comment

              Working...
              X