PhpPaket: Unterschied zwischen den Versionen

Aus Info-Theke
Zur Navigation springen Zur Suche springen
 
(17 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 4: Zeile 4:
* [[PhpDebugger]]
* [[PhpDebugger]]
* [[PHP]]
* [[PHP]]
* [[PhpPackage]]


== Installation ==
== Installation ==
<syntaxhighlight lang="bash">
PHP_VERS=8.2
apt install php$PHP_VERS php$PHP_VERS-{cli,common,curl,fpm,gd,igbinary,imagick,imap,intl,mbstring,memcached,msgpack,mysql,opcache,phpdbg,readline,redis,xdebug,xml,zip}
</syntaxhighlight>
<pre>add-apt-repository ppa:ondrej/php
<pre>add-apt-repository ppa:ondrej/php
apt-get install nginx php-fpm php-cli php-json php-curl php-imap php-gd php-mysql php-xml \
  php-zip php-intl php-mcrypt php-imagick php-mbstring
apt-get install php-memcached memcached php-xdebug
apt-get install php5.6-cli php5.6-common php5.6-curl php5.6-fpm php5.6-gd php5.6-imap \
apt-get install php5.6-cli php5.6-common php5.6-curl php5.6-fpm php5.6-gd php5.6-imap \
   php5.6-intl php5.6-json php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-opcache \
   php5.6-intl php5.6-json php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-opcache \
   php5.6-readline php5.6-sqlite3 php5.6-xml php5.6-zip  
   php5.6-readline php5.6-sqlite3 php5.6-xml php5.6-zip  
# oder
</pre>
apt-get install php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-imap \
* Ersatz von php7.3-mcrypt: [[https://stackoverflow.com/questions/48275494/issue-in-installing-php7-2-mcrypt stackoverflow]]
  php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-opcache \
  php7.0-readline php7.0-sqlite3 php7.0-xml php7.0-zip
# oder
apt-get install php7.1-cli php7.1-common php7.1-curl php7.1-fpm php7.1-gd php7.1-imap \
  php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache \
  php7.1-readline php7.1-sqlite3 php7.1-xml php7.1-zip
# oder
apt-get install php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.2-gd php7.2-imap \
  php7.2-intl php7.2-json php7.2-mbstring php7.2-mcrypt php7.2-mysql php7.2-opcache \
  php7.2-readline php7.2-sqlite3 php7.2-xml php7.2-zip
# oder
apt-get install php7.2-cli php7.2-common php7.2-curl php7.2-fpm php7.3-gd php7.3-imap \
  php7.3-intl php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache \
  php7.3-readline php7.3-sqlite3 php7.3-xml php7.3-zip
# php7.3-mcrypt ist nicht mehr unterstützt!


</pre>
= Repository einrichten =
<syntaxhighlight lang="bash">
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL  https://packages.sury.org/php/apt.gpg| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
sudo apt update
sudo apt install php8.1
</syntaxhighlight>


== Error-Logging ==
== Error-Logging ==
Zeile 41: Zeile 34:
** error_reporting(E_ALL);
** error_reporting(E_ALL);
** error_log("=== start");
** error_log("=== start");
== Wichtige Konfiguration in php.ini ==
* PHP_VERS=8.2
* /etc/php/$PHP_VERS/fpm/php.ini
<pre>
memory_limit = 2048M
upload_max_filesize = 512M
max_file_uploads = 100
post_max_size = 512M
max_execution_time = 600
max_input_time = 600
default_socket_timeout = 600
[Session]
#session.save_handler = files
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"
[opcache]
opcache.enable=1
opcache.memory_consumption=1024
opcache.interned_strings_buffer=512
[XDebug]
; Ist normalerweise in xdebug-spezifischer Konfiguration, z.B. mods.d/20-xdebug
;zend_extension="/usr/lib/php/20160303/xdebug.so"
xdebug.remote_port=9004
xdebug.remote_enable=On
xdebug.remote_host=192.168.100.100
; Alternativ: remote-Adresse selber ermitteln:
;xdebug.remote_connect_back=On
xdebug.remote_log=/var/log/php/xdebug.log
xdebug.remote_autostart=1
</pre>
* pool.d/www.conf
<pre>
pm.max_children = 30
pm.start_servers=20
pm.min_spare_servers = 20
pm.max_spare_servers = 30
</pre>
* in NGINX:
** fastcgi_read_timeout 3600s;


== Konfiguration ausgeben ==
== Konfiguration ausgeben ==
<pre>php -i
<pre>php -i
php7.4 -i | egrep "^(memory_limit|upload_max_filesize|max_file_uploads|post_max_size|max_execution_time|max_input_time|session.save_handler"
</pre>
</pre>

Aktuelle Version vom 30. September 2024, 13:14 Uhr


Links[Bearbeiten]

Installation[Bearbeiten]

PHP_VERS=8.2
apt install php$PHP_VERS php$PHP_VERS-{cli,common,curl,fpm,gd,igbinary,imagick,imap,intl,mbstring,memcached,msgpack,mysql,opcache,phpdbg,readline,redis,xdebug,xml,zip}
add-apt-repository ppa:ondrej/php
apt-get install php5.6-cli php5.6-common php5.6-curl php5.6-fpm php5.6-gd php5.6-imap \
   php5.6-intl php5.6-json php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-opcache \
   php5.6-readline php5.6-sqlite3 php5.6-xml php5.6-zip 

Repository einrichten[Bearbeiten]

sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
curl -fsSL  https://packages.sury.org/php/apt.gpg| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/sury-keyring.gpg
sudo apt update 
sudo apt install php8.1

Error-Logging[Bearbeiten]

  • php.ini:
    • error_log = /var/log/php/php.log
    • log_errors = on
  • im Programm:
    • error_reporting(E_ALL);
    • error_log("=== start");

Wichtige Konfiguration in php.ini[Bearbeiten]

  • PHP_VERS=8.2
  • /etc/php/$PHP_VERS/fpm/php.ini
memory_limit = 2048M
upload_max_filesize = 512M
max_file_uploads = 100
post_max_size = 512M
max_execution_time = 600
max_input_time = 600
default_socket_timeout = 600
[Session]
#session.save_handler = files
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"

[opcache]
opcache.enable=1
opcache.memory_consumption=1024
opcache.interned_strings_buffer=512

[XDebug]
; Ist normalerweise in xdebug-spezifischer Konfiguration, z.B. mods.d/20-xdebug
;zend_extension="/usr/lib/php/20160303/xdebug.so"
xdebug.remote_port=9004
xdebug.remote_enable=On
xdebug.remote_host=192.168.100.100
; Alternativ: remote-Adresse selber ermitteln:
;xdebug.remote_connect_back=On
xdebug.remote_log=/var/log/php/xdebug.log
xdebug.remote_autostart=1
  • pool.d/www.conf
pm.max_children = 30
pm.start_servers=20
pm.min_spare_servers = 20
pm.max_spare_servers = 30
  • in NGINX:
    • fastcgi_read_timeout 3600s;

Konfiguration ausgeben[Bearbeiten]

php -i
php7.4 -i | egrep "^(memory_limit|upload_max_filesize|max_file_uploads|post_max_size|max_execution_time|max_input_time|session.save_handler"