Can't run PHP after a new installation of XAMPP

落花浮王杯 提交于 2019-12-13 00:17:46

问题


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.

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.


回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/49828593/cant-run-php-after-a-new-installation-of-xampp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!