• This forum has a zero tolerance policy regarding spam. If you register here to publish advertising, your user account will be deleted without further questions.

[Gelöst] PHP Version ändern

Lord_Icon

Member
Moin,

Ich hab Debian 9 mit PHP 7.0 als Default am Laufen.
Da ich aber noch ein paar ältere Projekte habe brauche ich u.a. auch noch PHP 5.6.
Die habe ich auch alle drin

Code:
ls -la /etc/php/
drwxr-xr-x   3 root root 4,0K Dez 30 01:48 5.3
drwxr-xr-x   7 root root 4,0K Dez 30 12:30 5.6
drwxr-xr-x   7 root root 4,0K Dez 30 12:30 7.0
drwxr-xr-x   6 root root 4,0K Dez 30 01:50 7.1
drwxr-xr-x   6 root root 4,0K Dez 30 01:52 7.2
drwxr-xr-x   6 root root 4,0K Dez 30 01:54 7.3
drwxr-xr-x   3 root root 4,0K Dez 30 01:49 7.4

ls -la /opt/phpfarm/inst/
drwxr-xr-x 3 root root 4,0K Dez 30 01:48 php-5.3
drwxr-xr-x 3 root root 4,0K Dez 30 01:55 php-5.6
drwxr-xr-x 3 root root 4,0K Dez 30 01:48 php-7.0
drwxr-xr-x 3 root root 4,0K Dez 30 01:50 php-7.1
drwxr-xr-x 3 root root 4,0K Dez 30 01:52 php-7.2
drwxr-xr-x 3 root root 4,0K Dez 30 01:54 php-7.3


which php
/usr/bin/php

php -v
PHP 7.0.33-14+0~20191218.25+debian9~1.gbpae1889 (cli) (built: Dec 18 2019 15:02:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.3.9, Copyright (c) 2002-2019, by ionCube Ltd.
    with Zend OPcache v7.0.33-14+0~20191218.25+debian9~1.gbpae1889, Copyright (c) 1999-2017, by Zend Technologies

php --ini
Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File:         /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
Additional .ini files parsed:      /etc/php/7.0/cli/conf.d/00-ioncube.ini,
/etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.0/cli/conf.d/10-opcache.ini,  => ++++++ etliche weitere Files

Wie gesagt brauche ich aber 5.6. Also neuen VHOST angelegt
Code:
<Directory "/var/www/htdocs/ks010/html">
  AllowOverride Indexes FileInfo Limit AuthConfig Options=All,Includes,Indexes,MultiViews,SymLinksIfOwnerMatch
  Options +FollowSymLinks +SymLinksIfOwnerMatch +ExecCGI +Includes
  FcgidWrapper /var/www/htdocs/ks010/php-fcgi-starter .php
  <FilesMatch \.php$>
   SetHandler fcgid-script
  </FilesMatch>
  <IfModule mod_access.c>
   Allow from all
  </IfModule>
</Directory>


<Directory "/var/www/htdocs/ks010/html/webdav">
  DAV on
  Options +Indexes
  AuthType Basic
  AuthName DAV
  AuthUserFile /etc/apache2/webdavpasswords
  Require valid-user
</Directory>
<VirtualHost 123.456.789.10:80>
ServerName meinedomain.de
ServerAlias www.meinedomain.de
SuexecUserGroup ks010 ks010
DocumentRoot "/var/www/htdocs/ks010/html"
ScriptAlias /cgi-bin/ /var/www/htdocs/ks010/nocgi

<IfModule mod_fcgid.c>
  AddHandler fcgid-script .php
  #RLimitNPROC 10
</IfModule>

</VirtualHost>

Da ich in der VHOST: FcgidWrapper /var/www/htdocs/ks010/php-fcgi-starter angegeben habe, diese Datei auch noch angelegt:
Code:
#!/bin/sh
umask 022
PHPRC=/etc/php/5.6/ks010/
export PHPRC
export TMPDIR=/var/www/htdocs/ks010/temp
exec /usr/bin/php-cgi

Dort verweise ich auf: PHPRC=/etc/php/5.6/ks010/ ... da drin liegt die passende php.ini. Die hab ich weitesgehend so gelassen.... nur am Ende noch ein bissel was angefügt
Code:
...
session.bug_compat_42 = 0
session.bug_compat_warn = 0
allow_url_fopen = On
allow_url_include = On
mysql.allow_persistent = Off
display_errors = On
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
log_errors = Off
report_zend_debug = Off
apc.slam_defense = Off
post_max_size = 256M
upload_max_filesize = 256M
memory_limit = 128M
upload_max_filesize = 128M
max_execution_time = 1200
max_input_vars = 10000
max_input_time = 300
short_open_tag = On
date.time = Europe/Berlin

Den Indianer dann erfolgreich durchgestartet und eine phpinfo Datei angelegt.
Leider bleibe ich bei meiner 7er Version.
PHP Version 7.0.33-14+0~20191218.25+debian9~1.gbpae1889

SystemLinux mail.domain.de 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3 (2019-02-02) x86_64
Build DateDec 18 2019 15:02:34
Server APICGI/FastCGI
Virtual Directory Supportdisabled
Configuration File (php.ini) Path/etc/php/7.0/cgi
Loaded Configuration File/etc/php/5.6/ks010/php.ini
Scan this dir for additional .ini files/etc/php/7.0/cgi/conf.d

Habe ich ncoh was vergessen?
Warum wird in der phpinfo zwei mal ein falscher Pfad (Configuration File + Scan this dir for additional .ini files) angezeigt?

Danke für Ideen oder Tipps... falls noch Ausgaben fehlen bitte erfragen. Reiche ich umgehend ein.
 
Last edited:
Gelöst.

Code:
#!/bin/sh
umask 022
PHPRC=/etc/php/7.0/ks010/
export PHPRC
export TMPDIR=/var/www/htdocs/ks010/temp
exec /opt/phpfarm/inst/php-5.6/bin/php-cgi

PHPRC = muß wohl weiterhin auf 7.0 stehen.
letztendlich wird es dann aber über den letzten Befehl (exec) an phpfarm umgebogen
 
Die PHPRC sollte das eigentlich nicht bewirken, im Gegenteil, sie sollte sogar auf ein Verzeichnis zeigen, wellches eine php.ini enthält, die zur PHP-Version passt.
Warum verwendest du nicht das modernere (und meiner Meinung nach bessere) PHP-FPM, ist seit PHP5.3 offiziell in die PHP-Quellen eingezogen? Damit werden dann auch Mechnismen wie suPHP/suexec zumindest in einer reinen PHP-Umgebung überflüssig. ebenso dei Wrapper-Scripte. Auch Paket-Updates von PHP sind damit einfacher (für Debian gibt es Pakete für alle Versionen ab 5.6 im Repo von Ondřej Surý - das ist der PHP-Maintainer bei Debian).
 
Back
Top