Trying to learn php and freebsd at the same time

Dear friends,


I have a subject to learn php. They tell me to install XAMPP (Windows) to build a basic local server. I have read many times that the best way to learn Freebsd is by trying to make a concrete project. A long time ago I installed Freebsd in a partition and used it like crazy ... I broke it.

I think that building a small server can be a good exercise to train seriously with Freebsd. My php book says this:

"The development server to work with PHP must consist of the following:

- A web server .... the most popular of all is the Apache.
-The PHP environment
-A text editor.

It is possible to download all the elements independently, install them and configure them, but the process can be very laborious and complicated if you do not have practice. It is much easier to use an already configured installation package that simplifies the installation tasks of the web server and PHP as XAMPP. "


Well, I want to do just that: download the elements, install them and configure them ... in Freebsd. For now, these are my questions:

1) Is it better to use an old PC or a virtual machine?
2) I install freebsd, Apache, php environment (which?) .... and I could start practicing php?


I'm going to use the FreeBSD Handbook to try to build this. Thank you very much for your time.


Greetings from Spain
 
1) Choose the one that you can work easiest with. Servers are usually managed remotely with SSH anyway.

2) After installing the FreeBSD it is probably easiest for a beginner to use mod_php. You can install that with
pkg install mod_php72
It comes with Apache, so you just need to configure it and start the service to start practicing PHP.
 
It is possible to download all the elements independently, install them and configure them, but the process can be very laborious and complicated if you do not have practice.
It is neither laborious nor complicated. All of those will work upon installation including Apache which will serve up a home page by just starting it up. Getting them all to work together will require instruction if you haven't done it before but that's only two components, PHP and Apache. I'll leave the database out of it for now.

This is also true for other servers, specifically nginx and h2o which we use.

Is it better to use an old PC or a virtual machine?
Either is fine but a PC makes things easier since you don't have to potentially fiddle with anything in the VM to make it work. But why use an old PC? Why not a new one?

I install freebsd, Apache, php environment (which?) .... and I could start practicing php?
You don't need Apache to practice PHP.
 
But whatever you do make sure this system will be restricted to your local network and won't be reachable from the Internet. It wouldn't be the first time a server got overrun due to mishaps within some PHP scripts.
 
Recent PHP provides a small inbuilt webserver for testing purposes. This might be better to start out rather than wrangling Apache.

Code:
$ php -S 0.0.0.0:8080

This will serve the current directory on port 8080 when you open it with a web browser.

You may need to add the php version on the end of the binary for it to work. i.e php56.
 
Back
Top