You are not logged in.

#1 2019-06-28 03:47:35

chalybeum
Member
Registered: 2019-06-28
Posts: 3

[SOLVED] How to get PHP working in users public_html folder?

Hi there,
I managed to get PHP to work in /srv/http. While HTML is doing fine in my ~/public_html folder I can't for the life of me figure out how to execute PHP.

According to the Wiki, I commented/ uncommented:

#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

then added:

LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php

and

Include conf/extra/php7_module.conf

to my /etc/httpd/conf/httpd.conf

Now while I can't find any mention of user directories in regard to PHP in the English Wiki the German one suggests to add:

<Directory /home/*/public_html>
  AllowOverride FileInfo AuthConfig Limit Indexes
  Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI
  <Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
  </Limit>
  <LimitExcept GET POST OPTIONS PROPFIND>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>

in /etc/httpd/conf/extra/httpd-userdir.conf. The ExecCGI looked promising but sadly this also has zero effect.

I keep reading about either commenting out or substitute Off with On in:

<IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>

in /etc/apache2/mods-available/php5.conf on Debian based system. Well, obviously this doesn't hold true for Arch. But I wondered if there was an equivalent but couldn't find anything.

Searching the web gives repeating articles about this on Ubuntu and friends but seems to be inexistent on Arch. Did I miss something so obvious that everyone else is getting it?

Last edited by chalybeum (2019-07-02 13:16:02)

Offline

#2 2019-06-28 13:10:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: [SOLVED] How to get PHP working in users public_html folder?

What error(s) do you get from php files in the user directories?

At very least, you'll need to add those paths to open_basedir


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-06-28 15:00:29

chalybeum
Member
Registered: 2019-06-28
Posts: 3

Re: [SOLVED] How to get PHP working in users public_html folder?

Hi, thanks for your reply.

I'm getting a simple Server Error! Error 500

I suppose you meant the open_base dir in php.ini?

I uncommented and added /home/<myusername>/public_html to it and restarted httpd.service.
Still the same...

Is there anything I can do or post ( any debug commands, logfiles... ) that are helpful?

Offline

#4 2019-06-28 15:21:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,525
Website

Re: [SOLVED] How to get PHP working in users public_html folder?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2019-07-02 13:15:09

chalybeum
Member
Registered: 2019-06-28
Posts: 3

Re: [SOLVED] How to get PHP working in users public_html folder?

Thank heavens (and Trilby) I did it!

For the sake of completeness and to help future visitors:


As I stated in my first post the german WIKI suggests these settings:

<Directory /home/*/public_html>
  AllowOverride FileInfo AuthConfig Limit Indexes
  Options MultiViews Indexes SymLinksIfOwnerMatch ExecCGI
  <Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
  </Limit>
  <LimitExcept GET POST OPTIONS PROPFIND>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>

I changed:

  <Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
  </Limit>

to

  <Limit GET POST OPTIONS PROPFIND>
       Require all granted
  </Limit>

and now everything's working as expected.

Last edited by chalybeum (2019-07-02 13:17:10)

Offline

Board footer

Powered by FluxBB