当我尝试从我的网络(在 render.com 上)提交 PHP 表单时,我收到以下错误:

When I try to submit a PHP form from my web (on render.com) I get this error:

提问人:Julia 提问时间:10/20/2023 更新时间:10/24/2023 访问量:41

问:

当我尝试从我的网络提交PHP表单时,出现以下错误:

警告:require(/var/www/html/vendor/composer/.../symfony/polyfill-ctype/bootstrap.php):无法打开流:第 41 行的 /var/www/html/vendor/composer/autoload_real.php 中没有此类文件或目录

致命错误:require():无法打开“/var/www/html/vendor/composer/.../symfony/polyfill-ctype/bootstrap.php”(include_path='.:/usr/local/lib/php')在第 41 行的 /var/www/html/vendor/composer/autoload_real.php

使用 XAMPP 在我的本地环境中进行测试时,该表单工作正常。我应该会收到一封电子邮件到我的 gmail 地址。

我应该在我的 gmail 中收到表单内容。我尝试了很多东西。文件已就位。

PHP 表单 部署 呈现 自动加载

评论

0赞 ADyson 10/20/2023
The files are in place...恭敬地,PHP不同意你的观点,它不会说谎。仔细检查文件是否存在于 Web 服务器上并且位于正确的位置。
0赞 YvesLeBorg 10/20/2023
计算机上的 www 用户是否对目录具有读取权限?“vendor”目录的所有者是否与文档根目录中其他PHP文件的所有者相同?
1赞 volkerschulz 10/20/2023
@ADyson是对的。尝试在 Web 根目录内的 Web 服务器上运行。rm -rf vendor && composer update -v

答:

1赞 Julia 10/23/2023 #1

Dockerfile 设置不正确。更新后,它工作正常。如果有人想看它,这里就是它。

//Use an official PHP runtime as the base image

FROM php:7.4-apache

//Set the working directory in the container

WORKDIR /var/www/html

//Copy just the necessary files for Composer installation

COPY composer.json composer.lock /var/www/html/

//Install Composer
RUN apt-get update && apt-get install -y unzip && \
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

//Install project dependencies with Composer

RUN composer install --no-dev

//Copy the rest of your PHP files to the container

COPY . /var/www/html

//Expose port 80 for the Apache web server

EXPOSE 80

//Start the Apache web server

CMD ["apache2-foreground"]