GNU/Linux >> Linux Esercitazione >  >> Linux

Esecuzione di phpmyadmin e suphp

In /etc/apache2/mods-available/suphp.conf seguendo due righe:

AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-php

dovrebbe essere cambiato in:

AddType application/x-httpd-suphp .php .php3 .php4 .php5 .phtml
suPHP_AddHandler application/x-httpd-suphp

Quindi, nella riga /etc/suphp/suphp.conf

application/x-httpd-php=php:/usr/bin/php-cgi

dovrebbe essere cambiato in:

application/x-httpd-suphp=php:/usr/bin/php-cgi

Quindi, il contenuto di /etc/apache2/mods-available/php5.conf dovrebbe essere cambiato da:

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule>

a:

<Directory /usr/share>
    <IfModule mod_php5.c>
      AddType application/x-httpd-php .php .phtml .php3
      AddType application/x-httpd-php-source .phps
    </IfModule>
</Directory>

In questo modo, a tutti gli script php viene assegnato il tipo x-httpd-suphp che viene gestito da suphp. Poiché suphp è disabilitato per i file in /usr/share, in php5.conf per questa directory gli script php ottengono il tipo x-httpd-php e sono gestiti da mod_php5. In questo modo, mantieni suphp per tutti gli altri script ad eccezione di quelli installati dal sistema in /usr/share.


I file di configurazione sono cambiati dal momento della risposta originale.

Questi file non devono più essere modificati:

/etc/apache2/mods-available/suphp.conf
/etc/suphp/suphp.conf

Questo file:

/etc/apache2/mods-available/php5.conf 

richiede solo <Directory /usr/share> wrapper attorno al file corrente.

ad esempio:

<Directory /usr/share>
  {original php5.conf contents}
</Directory>

==Copie correnti dei file per ==

NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"
Linux anon 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

[email protected] [~]# cat /etc/apache2/mods-available/suphp.conf

<IfModule mod_suphp.c>
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler application/x-httpd-suphp
    </FilesMatch>
        suPHP_AddHandler application/x-httpd-suphp

    <Directory />
        suPHP_Engine on
    </Directory>

    # By default, disable suPHP for debian packaged web applications as files
    # are owned by root and cannot be executed by suPHP because of min_uid.
    <Directory /usr/share>
        suPHP_Engine off
    </Directory>

# # Use a specific php config file (a dir which contains a php.ini file)
#       suPHP_ConfigPath /etc/php5/cgi/suphp/
        suPHP_ConfigPath /etc/php5/apache2
# # Tells mod_suphp NOT to handle requests with the type <mime-type>.
#       suPHP_RemoveHandler <mime-type>
</IfModule>

[email protected] [~]# cat /etc/suphp/suphp.conf

[global]
;Path to logfile
logfile=/var/log/suphp/suphp.log

;Loglevel
loglevel=info

;User Apache is running as
webserver_user=www-data

;Path all scripts have to be in
docroot=/var/www:${HOME}/public_html

;Path to chroot() to before executing script
;chroot=/mychroot

; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true

;Send minor error messages to browser
errors_to_browser=false

;PATH environment variable
env_path="/bin:/usr/bin"

;Umask to set, specify in octal notation
umask=0077

; Minimum UID
min_uid=100

; Minimum GID
min_gid=100


[handlers]
;Handler for php-scripts
application/x-httpd-suphp="php:/usr/bin/php-cgi"

;Handler for CGI-scripts
x-suphp-cgi="execute:!self"

[email protected] [~]# cat /etc/apache2/mods-available/php5.conf

<FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
    SetHandler application/x-httpd-php-source
    # Deny access to raw php sources by default
    # To re-enable it's recommended to enable access to the files
    # only in specific virtual host or directory
    Order Deny,Allow
    Deny from all
</FilesMatch>
# Deny access to files without filename (e.g. '.php')
<FilesMatch "^\.ph(p[345]?|t|tml|ps)$">
    Order Deny,Allow
    Deny from all
</FilesMatch>

# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_flag engine Off
    </Directory>
</IfModule>

Linux
  1. Aumenta la sessione di timeout in phpMyAdmin

  2. Ottenere il tempo dell'utente e del kernel di un processo in esecuzione?

  3. Esecuzione di comandi Linux in background e in primo piano

  4. Installa Redis e Redis PHP su cPanel

  5. Esecuzione di uno script Python da PHP

Installazione di Apache e PHP su CentOS 8

Come impostare la versione php e phpmyadmin nel pannello di Plesk

Come installare e proteggere phpMyAdmin in Ubuntu 14.04

Come installare e proteggere phpMyAdmin su CentOS 8

Come installare e configurare Memcached su CentOS 8

Installa e configura phpMyAdmin