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

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\

Related

Wamp Server 3.1.4 showing (environment variable PATH) error

I am getting environment variable PATH error from wamp server.
already set the path (C:\wamp64\bin\php\php7.2.10) in advance system settings but again getting the same error
Sorry,
There is an error.
There is Wampserver path (c:/wamp64)
into Windows PATH environnement variable: (C:\wamp64\bin\php\php7.2.10)
It seems that a PHP installation is declared in the environment variable PATH
C:\wamp64\bin\php\php7.2.10
Wampserver does not use, modify or require the PATH environment variable.
Using a PATH on Wampserver or PHP version
is detrimental to the proper functioning of Wampserver.
Press ENTER to continue...
see the picture below:
how to resolve wamp server (path) error
The error is telling you that you have set the windows path to contain a folder to a version of PHP. WAMPServer does not need and does not like to have the PATH set to any version of PHP whether it came with WAMPServer or was installed some other way. It is all in the message on the Command Window.
So to remove the error, remove all references to any PHP you may have anywhere on your system from your PATH environment variable, regardless of whether it came with WAMPServer or was installed some other way.
The reason of course is that with WAMPServer you can have many versions of PHP installed into WAMPServer. If you notice it comes out of the box now with more than one version of PHP ready to go.
The Reason
If you add ONE of those PHP versions to the PATH, then when you switch to another version of PHP your PATH would still be pointing to the old version. You will undoubtedly forget to amend the PATH, and this will just cause confusion and issues, so we prefer you not to have any version of PHP on the path at all.
The PHP CLI
Ok so now you have no version of PHP on your path how will you run the PHP CLI (Command Line Interface) I hear you ask :)
To do this I have a little .bat/.cmd file that I place in a folder that is already on the Windows PATH so I can run it form anywhere.
I have already written that up in this answer to a previous question, so follow this link rather than me writing it all up in 2 places.

'perl' is not recognized as an external or internal command *Help configuring strawberry perl!*

I am teaching myself Perl, and I have installed Strawberry on my Windows 8 64 bit system. The Strawberry command line seems to work fine, and I have created a new folder in my Strawberry folder on my C drive to place my practice files (created in Notepad++) in.
I change to my directory containing the .pl files (which in my case is C:\Strawberry\programs), and try to run a program, for ex. perl practice1.pl. When I do this it says 'perl' is not recognized as an external or internal command. Not exactly sure what I'm doing wrong!
Please Set path,
Path :- Path is the OS Envirnment varialbe that used by OS to find executable files, you can find how to set path on google easily
if you don't want to set path then another solution is also there :-
Consider your perl is installed in this location :-
c:\perl\perl.exe
and your .pl files are in "Strawberry" folder that is in c drive ex:-
c:\Strawberry\perl_script1.pl
c:\Strawberry\perl_script2.pl etc.
then open cmd and navigate to perl directory ,
c:\perl\
use perl.exe and give the complete path of those files as argument
so for perl_script1.pl it will be
c:\perl\perl c:\Strawberry\perl_script1.pl // and same for other script also
Thanks :)

Unable to install plugin hostmanager in vagrant in windows 8.1

Not able to install plugin its showing the below error...
C:\devbox>vagrant plugin install 'vagrant-hostmanager'
The directory where plugins are installed (the Vagrant home directory)
has a space in it. On Windows, there is a bug in Ruby when compiling
plugins into directories with spaces. Please move your Vagrant home
directory to a path without spaces and try again.
Ruby (language used by Vagrant) has "issues" with directory names that contain spaces.
Vagrant will use an environment variable (supplied by windows) to tell it where your user directory is (so it can decide where to put your "home" directory). But you might have a space in your user name (I do) which causes a problem for ruby (which is doing the work to install the plugin).
The solution is to move your project to a project directory you choose that doesn't have any spaces in the directory name. Then, use an environment variable called VAGRANT_HOME and set it to a specified directory. The plugin installation procedure will check for the existence of this variable and use it if it exists instead of locating a home directory within the windows current user directory.
I created a folder called home within C:\Hashicorp\Vagrant and used that (C:\Hashicorp\Vagrant\home).
Setting windows environment variables is not hard (rather trivial actually) - you can find out how here: http://www.computerhope.com/issues/ch000549.htm
You'll have to do a restart to your system for it to take effect (it all worked after a reboot for me).
I've found a slight variation to the #Reinsbrains answer. In order to have a home directory without spaces within its name. I created a junction to my user/home directory. In my case I decided to go with a Linux style structure, but any location would work. In an admin command prompt:
mkdir c:\home
mklink /j c:\home\maarten "c:\users\Maarten Bicknese"
Next set the VAGRANT_HOME environment variable to the newly created junction.
setx VAGRANT_HOME c:\home\maarten
Fire up a new command prompt and you're good to go!

Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML

I have downloaded strawberry PERL and writing one application with CGI Perl Apache on Winxp sp3).
One of the libraries (written by someone else) which I using uses XML::LibXML. When i load the page it gives Internal Server Error. From Apache error log i can see this error:
Can't load 'C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll' for module XML::LibXML: load_file:The specified module could not be found at C:/strawberry/perl/lib/DynaLoader.pm line 190.
C:/strawberry/perl/site/lib/auto/XML/LibXML/LibXML.dll exists with all permissions.
Also this library works properly on Linux. My application also works fine if I remove all code that needs LibXML.
Can anyone tell me when can be possible issue here.
If you peek into the source for DynaLoader you'll find
Many dynamic extension loading problems will appear to come from
this section of code: XYZ failed at line 123 of DynaLoader.pm.
Often these errors are actually occurring in the initialisation
C code of the extension XS file. Perl reports the error as being
in this perl code simply because this was the last perl code
it executed.
You should have also gotten (but may not have noticed) the following dialog, which provides a more accurate error message:
The problem isn't that perl can't find LibXML.dll; it's that LibXML.dll can't find the real libxml. (The former is just a wrapper that provides Perl bindings for the latter.) To fix that you need to ensure that Strawberry Perl's c\bin folder is in your PATH. In your case, that would be C:\strawberry\c\bin.
You might have to check the environment variable settings in the windows,
make sure that the installation path of the module is present in the PATH variable.
The reason it works in linux is that make files usually set the environment variables for you in linux in windows it may not have set properly.
For eg;
go to Control Panel\System and Security\System click change settings then advanced tab in user variable section see if there is a variable called perl5lib.
if not create an new perl5lib variable and add the path of your library ( usuall C:\Perl\site\lib but may be different in your case)
I had the same issue after installing Strawberry perl. It was working fine when I run the script from server, but not remotely from a automation tool. The issue was because of the Environment variables not updated when we run it remotely. So I did server reboot, which resolved the issue.
I encountered the same problem recently, in my case it was not related to PATH variable (it was already correct). The thing is I was executing my script from Git Bash console and as it turned out git-bash perl was being used instead of Strawberry (see git-bash perl should not be first in path). Switching to standard Windows CMD terminal helped.

Using zf-tool with xampp and Windows 7

I'm new to Zend Framework and i'm trying to do some tests on my local server. I use xampp on a Windows 7 pc.
So i downloaded the zend package who comes with a command line tool to setting up projects. Copied the folder with zf.sh on the hard-drive on the location C:\Program Files (x86)\ZendFrameworkCli\bin, than updated the system variables to make it work.
When i type in the command line "zf show version" i get an error by "php.exe". I guess this happens becouse php and apache are not installed on the OS but runs under xampp server.
So, there's any way to make it work with xampp? Thanx in advance.
You need to had the php executable path to you PATH variable. You can do this with the system icon in your configuration panel. You can also use a nice utility : RedmondPath ( http://sites.google.com/site/redmondlab/path)
After that, launch a command prompt and type php -v to make sure that all is correct.