der_eismann
Posts: 27
Joined: Sat Jan 21, 2017 5:10 pm
Location: Berlin

How To: Install & configure httpd (Apache web server) & PHP

Sat Apr 22, 2017 9:04 pm

Welcome to my next little Solus guide! Before we start, please remember: Solus is designed for desktops, not for servers. This guide is thought for developers or people who want to host small sites in their networks.
You can find the basics in the Solus Help Center, this guide will be more in-depth. MariaDB will follow as soon as it is available. If you have questions, tips or additions just write them down :)

Step 1
Install the web server & PHP

Code: Select all

sudo eopkg it httpd php

Step 2
Solus is a stateless OS, which means it serves a default configuration that is stored in /usr/. That's why we have to create our own config file in /etc/ - if we would modify the existing configuration it would be overwritten with the next update.

Code: Select all

sudo mkdir -p /etc/httpd/conf.d

Code: Select all

sudo gedit /etc/httpd/conf.d/httpd.conf
If you want you can now edit the Apache configuration and change the server name, ports, add directories and virtual hosts... whatever you like. You can overwrite all the settings found in the default config at /usr/share/defaults/httpd/httpd.conf, however do not copy and modify it as that will result in a syntax error.


Step 3
Because PHP is loaded via FPM and FastCGI and not via an Apache module the configuration is a bit more complex, but runs faster afterwards. So we just create a new php.conf and insert some lines.

Code: Select all

sudo gedit /etc/httpd/conf.d/php.conf
Now insert the following:
LoadModule proxy_module lib64/httpd/mod_proxy.so
LoadModule proxy_fcgi_module lib64/httpd/mod_proxy_fcgi.so
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
And restart the webserver & the PHP service:

Code: Select all

sudo systemctl restart httpd && sudo systemctl restart php-fpm


Step 4
The webserver should be up and running by now, so all that is left is your content. Copy your contents to /var/www or write your own:

Code: Select all

sudo nano /var/www/index.php
If you open your browser and enter localhost you should see your copied/created content.
Last edited by der_eismann on Thu Apr 27, 2017 12:20 pm, edited 3 times in total.

sunnyflunk
Development Team
Posts: 2969
Joined: Sun Mar 13, 2016 11:35 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Sun Apr 23, 2017 12:01 am

der_eismann wrote:
Sat Apr 22, 2017 9:04 pm

Code: Select all

sudo mkdir /etc/httpd && sudo mkdir /etc/httpd/conf.d
Thanks for making the documentation better :D

Also here you can do 'sudo mkdir -p /etc/httpd/conf.d' instead of both commands and it will make the parent directories

der_eismann
Posts: 27
Joined: Sat Jan 21, 2017 5:10 pm
Location: Berlin

Re: How To: Install & configure httpd (Apache web server) & PHP

Sun Apr 23, 2017 10:45 am

I'm giving my best to help Solus get more popular :)
Thanks for your addition, I edited it in my post, you learn something new everyday!

sasqwatch
Posts: 4
Joined: Sat Dec 23, 2017 11:25 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Wed Mar 14, 2018 2:17 am

So I've followed the instructions on this post to install httpd, PHP, and Maria DB. I've also installed XDebug and configured PHP to include the xdebug.so module. When I run phpinfo(); on my browser I can see that xdebug is being included in the PHP installation. It's there.

So, in a nutshell, I've got all the basic components I need to do my website development work on Solus. I use the following tools to do my development work:

- Eclipse Oxygen IDE (with PHP & PyDev plugins)
- DBeaver for my database development/enhancements on Maria DB.

This is all working with one little exception. I can't seem to get the debugger working in Eclipse with XDebug. When I run my PHP website in Eclipse in debug mode, the code runs fine but won't stop at my breakpoints. It just runs through and executes. I think it has something to do with the way PHP is handled in Solus (i.e. through FPM and FastCGI). But I'm not sure.

Everything I described above regarding my development environment is also setup and running on my Ubuntu installation and I do have XDebug working in Eclipse. This just works in Ubuntu, once I have PHP running with the XDebug module.

Does anyone have any experience with running an IDE like Eclipse that uses XDebug. There must be some configuration that needs to be done. I just can't seem to figure out how to connect Eclipse to XDebug and/or PHP.

This one little item is actually a show stopper for me in terms of using Solus as my daily driver. Otherwise, besides this one item, I would switch over in a heartbeat. Solus is a great system. Very clean and snappy.
Last edited by sasqwatch on Wed Mar 14, 2018 4:10 pm, edited 1 time in total.

PatrickPulfer
Posts: 1
Joined: Wed Mar 14, 2018 1:35 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Wed Mar 14, 2018 1:37 pm

Hey!

I'm a Linux newby and I've found this guide very helpful! Can't wait to see SQL part.


Cheers!

sasqwatch
Posts: 4
Joined: Sat Dec 23, 2017 11:25 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Thu Mar 15, 2018 8:55 pm

As per my previous post on this thread... I did a search on "eclipse & fstcgi" on the web. and got the following thread:

https://stackoverflow.com/questions/186 ... se#6814910

I just followed the instructions in that thread and got the debugger working in Eclipse immediately. BAM, done.

Having said all this, I've now switched from XUbuntu to Solus as my main driver. I absolutely love this
OS (and I've tried a few others).

Note: I installed HTTPD, PHP & XDEBUG, and MARIA DB from the Solus software center and followed the instructions
for installation and configuration as per this thread (see above).


Specific instructions for running xdebug in Eclipse:

sudo gedit etc/php/php.ini

Add the following lines at the end of this .ini config file:

zend_extension = /usr/lib64/php/modules/xdebug.so
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9001

Save your changes.
Run (in terminal):
sudo systemctl restart httpd && sudo systemctl restart php-fpm

Open Eclipse and create a debug configuration for what ever project you want to work on. Select
XDebug as the debugger and use port 9001 instead of 9000 (FastCGI is using port 9000).

Debugging with xdebug should now work in Eclipse, it's work great for me now.

I've now switched from XUbuntu to Solus as my main driver. I absolutely love this
OS (and I've tried a few others).

ghostv33
Posts: 2
Joined: Mon Nov 28, 2016 8:03 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Thu May 17, 2018 12:47 pm

How to set directory to a folder on my home directory?

CassBurn
Posts: 21
Joined: Fri Dec 08, 2017 10:45 pm

Re: How To: Install & configure httpd (Apache web server) & PHP

Thu Jun 14, 2018 9:28 pm

Hello.

I try to use a kanboard with httpd. I have a writable error.
Normally on other system I would add user group www-data, I also tried with apache.

Both of this user/group doesn't exist, anyone have a solution ?


----
@ghostv33

To change the DocumentRoot I've seen a solution with virtual host:

Code: Select all

DocumentRoot "/home/httpd/sites/site1"
ServerName   site1.com

<Directory "/home/httpd/sites/site1">
    Options -Indexes +FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
But I don't know which file you have to change :x

Tumultus
Posts: 15
Joined: Mon Oct 16, 2017 1:37 am

Re: How To: Install & configure httpd (Apache web server) & PHP

Sat Jun 16, 2018 4:05 am

Interesting Howto. So far, I've been using Bitnami Lamp Stack on Solus - installs without hick-ups and doesn't need much work afterwards. Next time I flaten out Solus and reinstall it, I'll give it a shot. :)

Return to “Tutorials”