简体   繁体   中英

Can't run PHP after a new installation of XAMPP

I have been a happy user of XAMPP for years, but today I have updated to the latest Windows 32 bit version on a Windows 10 machine. I couldn't see a 64 bit version. Anyway, all went well, and once I changed some settings, I was able to see all my old databases under the new phpMyAdmin. But my PHP scripts are bombing out before they start. Even phpinfo gives the same error message, which is...

"Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'F:/My Documents/OneDrive/Webs/htdocs/index.php' (include_path='.;C:/xampp/php/pear/PEAR') in Unknown on line 0"

The test script of index.php is nothing more than

<?php echo "HELLO"; ?>

The statement in php.ini is

include_path = ".;C:/xampp/php/pear/PEAR" 

and there are no other include_path statements. The directory C:/xampp/php/pear/PEAR does exist. The index.php file is there. I don't know why there's a PEAR folder inside a pear folder - that's how Xampp installed it. I have tried all variations of that include_path statement to no avail. I have left out one of the pears. Leaving out the include_path statement altogether just results in the PHP default which is a folder which is definitely not there, so that's no good.

My localhost is inside the OneDrive folder as you can see from the error message, but I have been doing it that way for years. Now I cannot run any PHP scripts. Pure HTML is no problem.

The new installation of Xampp has totally replaced the old one, and its Control Panel v3.2.2 looks to be working perfectly.

XAMPP控制面板截图

phpMyAdmin seems to be working fine, but not phpinfo, as said.

I have scanned the web for answers to this, and there is plenty of forum Q&A's, but they all tell me to do what I have done.

The computer is Windows 10 Pro, and is fully up to date. Apache 2.4.33. PHP 5.6.35. Database server is 10.1.31 MariaDB.

I've run out of ideas. Any help will be appreciated.

Thanks Mike.

You need to fix your include_path system variable to point to the correct location.

To fix it edit the php.ini file. In that file you will find a line that says, "include_path = ..." . (You can find out what the location of php.ini by running phpinfo() on a page.) Fix the part of the line that says, "\\xampplite\\php\\pear\\PEAR" to read "C:\\xampplite\\php\\pear". Make sure to leave the semi-colons before and/or after the line in place.

Restart PHP and you should be good to go. To restart PHP in IIS you can restart the application pool assigned to your site or, better yet, restart IIS all together.

first: check all the paths in the php. ini ( use a search or a grep to check them)

second: check that you don't have any extensions added twice (one in the beginning and one in the end of the file)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM