我试图在一个项目上执行一些PHP代码(使用Dreamweaver),但代码没有运行。
当我检查源代码时,PHP代码显示为HTML标记(我可以在源代码中看到它)。Apache运行正常(我正在使用XAMPP), PHP页面正在正常打开,但PHP代码没有被执行。
有人有什么建议吗?
注意:该文件已经命名为filename.php
编辑: 代码. .:
<?
include_once("/code/configs.php");
?>
我试图在一个项目上执行一些PHP代码(使用Dreamweaver),但代码没有运行。
当我检查源代码时,PHP代码显示为HTML标记(我可以在源代码中看到它)。Apache运行正常(我正在使用XAMPP), PHP页面正在正常打开,但PHP代码没有被执行。
有人有什么建议吗?
注意:该文件已经命名为filename.php
编辑: 代码. .:
<?
include_once("/code/configs.php");
?>
当前回答
在尝试了所有方法之后,我想出了这个解决方案
当默认情况下PHP 7.0 FPM未启用时,将出现此错误。
要在Apache2中启用PHP 7.0 FPM,运行:
sudo 2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
systemctl restart apache2
如果您使用的是php7.4,在上面的命令中输入7.4而不是7.0。
其他回答
检查你为php安装的所有包,使用:
yum list installed | grep remi
在你的机器上安装所有相关的php包,尤其是php-devel。
我发现了另一个导致这个问题的问题,并且已经解决了它。我不小心将脚本保存为UTF-16编码。PHP5似乎不能识别<?PHP标签默认为16位编码。
在尝试了以上所有方法都没有效果之后,考虑重新启动你的电脑。解决了我的。
我在Ubuntu上运行Apache,我的问题是/etc/apache2/mods-available/php5.conf文件缺少这个:
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
我把它添加回来,php正确地解析php文件。
It is possible to install phpmyadmin on raspberry 64 bit and it even was not difficult in my case. I am running several hp-laptops with openSuse Tumbleweed and some Raspberries. On the latest Raspberry 3 B + I 64bit raspbian buster light, kde plasma Desktop. Linux raspi10 5.10.60-v8+ #1449 SMP PREEMPT Wed Aug 25 15:01:33 BST 2021 aarch64 GNU/Linux I am using nginx 1.14.2 with fastcgi (not using 'sock') and php 8.0.10 (php-fpm). I downloaded 'composer' first. (Use apt or aptitude for that). After that go to https://docs.phpmyadmin.net/en/latest/setup.html Look for the shell command
composer create-project phpmyadmin/phpmyadmin
它将在当前目录中安装一个完整的目录'phpmyadmin'。 移动到/var/lib/并根据nginx.conf中的设置设置user:group权限 在我的例子中: chown -R www-data:www-data /var/lib/phpmyadmin
创建一个符号链接到/srv/www/public或/var/www/html或任何你的服务器正在寻找的东西。 您可以向phpMyAdmin添加第二个名为phpMyAdmin的符号链接 确保nginx.conf中的根指令相应设置。
我的nginx配置在我的所有机器上(几乎)是相同的。 它现在非常紧凑。 这是最简单的方法。所有进一步的服务器和功能可以稍后添加。 /etc/nginx/sites-enabled没有条目 /etc/nginx/vhosts.d中没有任何内容 从php.ini中的一个池开始。为了配置它,谷歌一点和测试 通过检查php-fpm的状态。