简体   繁体   中英

unable to run php cli from the command line when xampp portable is installed in another drive

I have installed a xampp portable package on my drive D, added the php folder path inside it on the system environment so I would be able to run php basically anywhere from the command line. but when i try to check if its working by executing the " php -v " command, it runs but i get this following error/warning messages.

" Warning: PHP Startup: Unable to load dynamic library 'xampp-portable\\php\\ext[:any].dll - The specified module could not be found. "

* the [:any] there just means some dll filename.

and i get a lot of that warnings with just varying dll filenames,

anyway, here's the catch. when i do change my current path in the command line to somewhere in drive D, and then run the same command " php -v " it runs smoothly.

so what configuration should i do to fix this problem?

by the way, i do the same with mysql, putting its bin directory path on the system enviroment, run it in both inside drive C and drive D. and it runs smoothly. so i guess this problem is only on php.

I've posted the same question in xampp forums and this is the answer that was given to me. I'll be quoting the answer as it was and give credit to the one who answere it.

XAMPP is very proud that it don't have to set any environment variables or registry values.

What you want to do is not possible with XAMPP portable without mapping to a specific Drive letter. All configurations in xampp portable have relative paths, so if you want to use cli from a different drive letter, php can be executed, but all extensions of them throw errors.

I would install the full version of XAMPP, map it to the current drive letter with help of the setup_xampp.bat file and use the XAMPP control panel Shell instead of default command line (advantage: The XAMPP control panel shell sets local include paths to the needed XAMPP folders).

Works for me (i can even use pear, git, composer, and other cli scripts with the Xampp Shell if correct integrated).

best wishes, Altrea

credits to Altrea

Open your php.ini file, replace all relative paths to absolute paths. Eg: \\xampp\\ to C:\\xampp\\

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