PHP Apache2 not serving *.php files

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

PHP Apache2 not serving *.php files

471 次查看
intosite
Contributor II

Got yocto to build with php and apache2 as show here

installing-PHP 

In my conf/local.conf i have set this

 

IMAGE_INSTALL:append = " php-dbg php-cli php-cgi php-fpm php-fpm-apache2 php-dev php-doc php"
PACKAGECONFIG:append:pn-php = " apache2 mysql sqlite3"

 

 

Flashed the image and in console php -v works. But the apache2 server cannot serve any .php files. It returns 'File not found. '

I uploaded my own php file to '/usr/share/apache2/default-site/htdocs'.

 

// /usr/share/apache2/default-site/htdocs/info.php
<?php
phpinfo();
?>

 

When I try to access it, browser returns 'File not found.' index.html and plain text .txt files work, so I can confirm apache is server files from the folder.

Found the file in '/usr/lib/php8/build' and ran it. Below is the output.

root@imx8mpevk:/usr/lib/php8/build# php run-tests.php

=====================================================================
PHP         : /usr/bin/php
PHP_SAPI    : cli
PHP_VERSION : 8.2.20
ZEND_VERSION: 4.2.20
PHP_OS      : Linux - Linux imx8mpevk 6.6.52-lts-next-ge0f9e2afd4cf #1 SMP PREEMPT Tue Nov 19 23:01:49 UTC 2024 aarch64
INI actual  : /etc/php/apache2-php8/php.ini
More .INIs  :
---------------------------------------------------------------------
PHP         : /usr/bin/php-cgi
PHP_SAPI    : cgi-fcgi
PHP_VERSION : 8.2.20
ZEND_VERSION: 4.2.20
PHP_OS      : Linux - Linux imx8mpevk 6.6.52-lts-next-ge0f9e2afd4cf #1 SMP PREEMPT Tue Nov 19 23:01:49 UTC 2024 aarch64
INI actual  : /etc/php/apache2-php8/php.ini
More .INIs  :
---------------------------------------------------------------------
CWD         : /usr/lib/php8/build
Extra dirs  :
VALGRIND    : Not used
=====================================================================
TIME START 2025-03-13 05:46:32
=====================================================================
No tests were run.

 

0 项奖励
回复
2 回复数

438 次查看
Harvey021
NXP TechSupport
NXP TechSupport

Hope the reference be helpful for you.

 

 

Regards

Harvey

0 项奖励
回复

430 次查看
intosite
Contributor II

It still does not work.

I've changed to serve the files from /var/www/html, static *.html files works, but *.php files return 'File not found. ' error

0 项奖励
回复