phppearmamp-pro

Getting a fatal PHP error on MAMP Pro after windows 10 update


MAMP PRO Windows v5.0.5 on Windows 10 PHP 8.1.0 (identical version for all hosts)

Everything was working yesterday. I restarted my machine which came with a Windows update and since I am getting this error:

PHP Fatal error:  Failed opening required 'C:/Users/Alex Leuschner/OneDrive/Mampilly/Polygon/market-data/index.php' (include_path='.;C:\php\pear') in Unknown on line 0

The index.php file is a simple PHP that echos a string.

echo 'Hello World';

I installed PEAR in C:\

PS C:\> php go-pear.phar

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : C:\
 2. Temporary directory for processing            : C:\tmp
 3. Temporary directory for downloads             : C:\tmp
 4. Binaries directory                            : C:\
 5. PHP code directory ($php_dir)                 : C:\pear
 6. Documentation directory                       : C:\docs
 7. Data directory                                : C:\data
 8. User-modifiable configuration files directory : C:\cfg
 9. Public Web Files directory                    : C:\www
10. System manual pages directory                 : C:\man
11. Tests directory                               : C:\tests
12. Name of configuration file                    : C:\WINDOWS\pear.ini
13. Path to CLI php.exe                           : C:\MAMP\bin\php\php8.1.0

1-13, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\WINDOWS\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.14.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.3.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.13.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar://C:/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.5.tar...
warning: pear/PEAR dependency package "pear/Archive_Tar" downloaded version 1.4.14 is not the recommended version 1.4.4
install ok: channel://pear.php.net/Archive_Tar-1.4.14
install ok: channel://pear.php.net/Console_Getopt-1.4.3
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.4.5
install ok: channel://pear.php.net/PEAR-1.10.13
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

******************************************************************************
WARNING!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<C:\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <C:\MAMP\bin\php\php8.1.0\php.ini>? [Y/n] : y

php.ini <C:\MAMP\bin\php\php8.1.0\php.ini> include_path updated.

Current include path           : C:\MAMP\bin\php\php8.1.0\
Configured directory           : C:\pear
Currently used php.ini (guess) : C:\MAMP\bin\php\php8.1.0\php.ini
Press Enter to continue:

** WARNING! Old version found at C:\, please remove it or be sure to use the new c:\\pear.bat command

The 'pear' command is now at your service at c:\\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\\pear.bat' until you have added
** 'C:\' to your PATH environment variable.

Run it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.

For more information about PEAR, see:

  http://pear.php.net/faq.php
  http://pear.php.net/manual/

Thanks for using go-pear!



* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.

In PHP.ini I updated the include page to: C:\MAMP\bin\php\php8.1.0\ I verified on the command line, php -i and get: include_path => C:\MAMP\bin\php\php8.1.0\ => C:\MAMP\bin\php\php8.1.0\

When I try again, I get the updated error: PHP Fatal error: Failed opening required 'C:/Users/Alex Leuschner/OneDrive/Mampilly/Polygon/market-data/index.php' (include_path='C:\MAMP\bin\php\php8.1.0\') in Unknown on line 0

Thanks for your help!


Solution

  • As commented by @kmoser, this question solved the issue: Windows updateWarning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

    I moved my files out of OneDrive and no longer experienced the issue when executing a PHP script.