logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: PHP settings in apache2 config file completely ignored
Author
obconf



Joined: 23 Sep 2020
Posts: 3

PostPosted: Wed 23 Sep '20 13:48    Post subject: PHP settings in apache2 config file completely ignored Reply with quote

Hi all,

On a fresh Debian 9 install, I installed PHP 7.2 and Apache2.

php has been installed from the Sury repo with these extensions:

Code:
php7.2-mysql php7.2-dom
php7.2-simplexml php7.2-ssh2 php7.2-xml
php7.2-xmlreader php7.2-curl php7.2-exif php7.2-gd  php7.2-iconv php7.2-imagick
php7.2-json
php7.2-mbstring php7.2-posix php7.2-sockets php7.2-tokenizer
php7.2-soap php7.2-intl php7.2-mbstring


everything seem to be working fine I even managed to
install wordpress on the server, however if I try to
ovrride the php.ini configs in the virtualhost config for Apache2 they are not overridden
no matter where I put them in the file, I tried in and outside the
Directory tag and I tried php_admin_value, php_value,
php_flag and php_admin_flag. None of them is working
and I'm not sure what to do to solve this.
I need to override the open_basedir settings because
I need to host multiple websites on the same server, so it's very important for its security.

Loaded modules from php info:

Code:
core mod_so mod_watchdog
http_core mod_log_config mod
logio mod_version
mod_unixd mod_access_compat
mod_alias mod_auth_basic
mod_authn_core mod_authn_file
mod_authz_core mod_authz_host
mod_authz_user mod_autoindex
mod_deflate mod_dir
mod_env mod_filter mod_headers
mod_mime prefork mod_negotiation
mod_php7 mod_reqtimeout mod_rewrite
mod_setenvif mod_status



Loaded Configuration File
Code:
/etc/php/7.2/apache2/php.ini


Additional .ini files parsed:

Code:
/etc/php/7.2/apache2/conf.d/10-mysqlnd.ini,
/etc/php/7.2/apache2/conf.d/10-opcache.ini,
/etc/php/7.2/apache2/conf.d/10-pdo.ini,
/etc/php/7.2/apache2/conf.d/15-xml.ini,
/etc/php/7.2/apache2/conf.d/20-calendar.ini,
/etc/php/7.2/apache2/conf.d/20-ctype.ini,
/etc/php/7.2/apache2/conf.d/20-curl.ini,
/etc/php/7.2/apache2/conf.d/20-dom.ini,
/etc/php/7.2/apache2/conf.d/20-exif.ini,
/etc/php/7.2/apache2/conf.d/20-fileinfo.ini,
/etc/php/7.2/apache2/conf.d/20-ftp.ini,
/etc/php/7.2/apache2/conf.d/20-gd.ini,
/etc/php/7.2/apache2/conf.d/20-gettext.ini,
/etc/php/7.2/apache2/conf.d/20-iconv.ini,
/etc/php/7.2/apache2/conf.d/20-imagick.ini,
/etc/php/7.2/apache2/conf.d/20-intl.ini,
/etc/php/7.2/apache2/conf.d/20-json.ini,
/etc/php/7.2/apache2/conf.d/20-mbstring.ini,
/etc/php/7.2/apache2/conf.d/20-mysqli.ini,
/etc/php/7.2/apache2/conf.d/20-pdo_mysql.ini,
/etc/php/7.2/apache2/conf.d/20-phar.ini,
/etc/php/7.2/apache2/conf.d/20-posix.ini,
/etc/php/7.2/apache2/conf.d/20-readline.ini,
/etc/php/7.2/apache2/conf.d/20-shmop.ini,
/etc/php/7.2/apache2/conf.d/20-simplexml.ini,
/etc/php/7.2/apache2/conf.d/20-soap.ini,
/etc/php/7.2/apache2/conf.d/20-sockets.ini,
/etc/php/7.2/apache2/conf.d/20-ssh2.ini,
/etc/php/7.2/apache2/conf.d/20-sysvmsg.ini,
/etc/php/7.2/apache2/conf.d/20-sysvsem.ini,
/etc/php/7.2/apache2/conf.d/20-sysvshm.ini,
/etc/php/7.2/apache2/conf.d/20-tokenizer.ini,
/etc/php/7.2/apache2/conf.d/20-wddx.ini,
/etc/php/7.2/apache2/conf.d/20-xmlreader.ini,
/etc/php/7.2/apache2/conf.d/20-xmlwriter.ini,
/etc/php/7.2/apache2/conf.d/20-xsl.ini


.

Code:
 Server Root   /etc/apache2


Strangely enough the php info page returns DOCUMENT_ROOT and CONTEXT_DOCUMENT_ROOT as
Code:
/var/www/html

even though my virtual host's root is
Code:
/var/www/html/<mydomain>/


ls /etc/apache2/sites-enabled/
Code:
000-default.conf <mydomain>.conf

.

ls /etc/apache2/conf-enabled/
Code:
charset.conf other-vhosts-access-log.conf
localized-error-pages.conf security.conf


.

ls /etc/apache2/mods-enabled/
Code:
access_compat.load  autoindex.conf  mime.conf         reqtimeout.load
alias.conf autoindex.load  mime.load         rewrite.load
alias.load
deflate.conf mpm_prefork.conf
setenvif.conf
auth_basic.load
deflate.load mpm_prefork.load
setenvif.load
authn_core.load dir.conf
negotiation.conf status.conf
authn_file.load dir.load
negotiation.load status.load
authz_core.load
env.load php7.2.conf
authz_host.load filter.load
php7.2.load
authz_user.load headers.load    reqtimeout.conf


.

mydomain.conf

Code:
 <VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port t$
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            #ServerName www.example.com
   
            ServerAdmin webmaster@localhost
            ServerName <mydomain>
            DocumentRoot /var/www/html/<mydomain>
            DirectoryIndex index.html
   
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
    #LogLevel info ssl:warn
   
            ErrorLog ${APACHE_LOG_DIR}/<mydomain>_error.log
            CustomLog ${APACHE_LOG_DIR}/<mydomain>_access.log combined
   
            # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
            # include a line for only one particular virtual host. For example the
            # following line enables the CGI configuration for this host only
            # after it has been globally disabled with "a2disconf".
            #Include conf-available/serve-cgi-bin.conf
   
            <Directory /var/www/html/<mydomain>>
                    AllowOverride All
                    Require host <mydomain>
                    #php_admin_flag engine Off
                    php_admin_value open_basedir /var/www/html/<mydomain>
            </Directory>
    </VirtualHost>
   
    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet


Admin note;
See Forum rules, moved the complete php.ini to https://apaste.info/vAYE

.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Thu 24 Sep '20 9:51    Post subject: Reply with quote

Did you enable you new vhost with a2ensite ?

Tried apache2ctl -S to view all your vhosts and the document roots?
Back to top
obconf



Joined: 23 Sep 2020
Posts: 3

PostPosted: Thu 24 Sep '20 12:31    Post subject: Reply with quote

James Blond wrote:
Did you enable you new vhost with a2ensite ?


Yes

James Blond wrote:
Tried apache2ctl -S to view all your vhosts and the document roots?


Code:
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server <IP address> (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost <IP address> (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost <mydomain> (/etc/apache2/sites-enabled/<mydomain>.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=<number>
Group: name="www-data" id=<number>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Mon 05 Oct '20 10:44    Post subject: Reply with quote

Maybe you can find the value by

Code:

cd /etc/php
grep -Rns "doc_root" *
Back to top


Reply to topic   Topic: PHP settings in apache2 config file completely ignored View previous topic :: View next topic
Post new topic   Forum Index -> Other Software