0

The problem

Just a heads up, I was figuring this out for several hours. I tried all the different ways that other people were doing and none of them worked for me. I figured that if this was this difficult for me to figure out, that, other people who were using Windows Substation for linux were also having issues. After reinstalling apache2, I did some research on Stack Overflow. I tried this, I made the folders on my particular folder executable. That didn't work.

I already have figured out how to get Drupal and WordPress to work, so, I knew that going into PHP was also going to be a challenge. For some reason, I do not have the same configuration files that other people have with the, where they tell you to find the PHP configuration files in the /etc/apache2/sites-available folder. With that being said, there is a really nice solution that already exists.

You don't need to go to install all the entire lamp application all over again. I strongly believe that I and these other users may have some files missing in their configurations, somehow, a link between apache2 and PHP didn't happen, or, whatever the reason, when I installed PHP on WSL, apache2 acted like nothing happens. These other tutorials where they already have everything installed and they act like they can just load PHP files like no problem are not helpful either.

Jake
  • 29

1 Answers1

0

It is in the PHP application

Using the command sudo php -S localhost:84 -t ./ will make the PHP server listen to a localhost, and, it will bind it to that particular port, and, you can open it. This makes the process of opening the file infintely easy, leaving you to need to worry more about the development of the PHP file, rather than, configuring it. For me, 90% of the difficulty of programming stems from configuration. Once that is set up, I can do everything else. For testing purposes, this is completely fine, it has been suggested in the past that using the phpinfo(); function will magically get the file to read, let's just finally debunk this myth as complete and total nonsense. I have had a similar issue to this user and to several other users, and, I may not be able to figure out how to get it to work, like they do, for some reason, I do not have the same files in the /etc/apache2/* folder, and, it's possible that the other things trouble-shooting steps that other have recommended helped, but, utlimately, if you are having this issue, and, I suspect other users are having this issue, I wanted to recommend this way as a sure fire way in order to get it to work. If you are just looking to get your PHP tested, this is a really good method to do it.

If you want to launch all the files in a directory, and, not worry about doing them one at a time

You would use the command with this syntax- sudo php -S localhost:84 -t ./. That way it binds it to that particular localhost port, and, you would be able to run all the files in that particular location, provided that you have all the syntax correct, and, everything else is in order. This would make it while not as robust as apache2, for, people out there that are struggling to get the other solution to work (and I bet that I am not the only one), this solution is a good alternative.
Jake
  • 29