私は10のスレッドを読みましたが、何が問題か分かりません。私は1つのマシン上でphp5とphp7が必要で、フォルダー内のスクリプトをphp7によって解釈させたい。アパッチ/ 2.4.23(Debianの)なぜ私のスクリプトにPHP7の代わりにPHP5を使用しますか
OS:Debianのテスト
どちらもPHPのバージョンがインストールされています
私はそう見てくださいのApache、構成の間違いを見つけることができません
/var/www/test# ls -l /usr/bin/php*
lrwxrwxrwx 1 root root 21 Okt 6 2015 /usr/bin/php -> /etc/alternatives/php
-rwxr-xr-x 1 root root 9065192 Jul 26 10:33 /usr/bin/php5
-rwxr-xr-x 1 root root 4422704 Sep 18 10:38 /usr/bin/php7.0
lrwxrwxrwx 1 root root 28 Okt 6 2015 /usr/bin/php-config -> /etc/alternatives/php-config
-rwxr-xr-x 1 root root 5237 Jul 26 10:33 /usr/bin/php-config5
lrwxrwxrwx 1 root root 24 Okt 6 2015 /usr/bin/phpize -> /etc/alternatives/phpize
-rwxr-xr-x 1 root root 4730 Jul 26 10:33 /usr/bin/phpize5
右のAddHandlerは、このフォルダ
nano /var/www/test/.htaccess
AddHandler application/x-httpd-php7 .php
そしてAllowOverwrのために設定されていますITEが設定されている
nano /etc/apache2/apache2.conf
...
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...
とPHP7は、サーバのコンテキストで
php -v
PHP 7.0.11-1 (cli) (NTS)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.11-1, Copyright (c) 1999-2016, by Zend Technologies
ではなく、コマンドラインで動作するデフォルトのanway
update-alternatives php
Auswahl Pfad Priorität Status
------------------------------------------------------------
* 0 /usr/bin/php7.0 70 automatischer Modus
1 /usr/bin/php5 50 manueller Modus
2 /usr/bin/php7.0 70 manueller Modus
する必要があります!
w3m http://localhost/test/info.php
PHP Version 5.6.24-0+deb8u1
System Linux ber-eagle02vm 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64
Build Date Jul 26 2016 08:17:13
Server API Apache 2.0 Handler
Virtual
Directory disabled
Support
Configuration
File (php.ini) /etc/php5/apache2
Path
Loaded
Configuration /etc/php5/apache2/php.ini
File
Scan this dir
for additional /etc/php5/apache2/conf.d
...
/mods-enabled/php7.confと/mods-enabled/php7.loadはApache設定に存在しますか? – andre
それはエラーの魔法、ありがとう!それでも、一度に1つのMODしか使用できません(下記参照)。しかし、少なくとも私はどの部分が欠落しているかを知っています。 – Paflow