Cannot run PHP CLI on WAMP on Windows 8 - windows-8

I have been trying on this for hours
i Get the below error
'php' is not recognized as an internal or external command,
operable program or batch file.
Steps i have done
1- I have added to Windows Environement variables C:\wamp\bin\php\php5.3.13;
2-re-installed wamp 2 times
3-Apache and php error log is clean
I have the below configuration
Windows 8 64 bit
Apache 2.2
PHP 5.3.13

Actually the php exe you run in wamp for the CLI is just php.exe
It is found in the c\wamp\bin\php\phpX.Y.Z\ folder and called php.exe
Suggest you create a little batch file to setup the path so you can use it from anywhere by just keying php, like this:
phppath.cmd
set path=%PATH%;c:\wamp\bin\php\phpX.Y.Z
php -v
Store this batch file in a folder on your path and you are golden.

You need to add php to your system path as follows:
go to system properties
chooose advance tab
check the system variables
choose Path then edit it and add at the end ;C:\xampp\php\
Note that system variables in Path are separated with ;
same thing applies to WAMP all you need is to specify your php binaries folder

seems that php-cli.exe dosent come along with WAMP, I installed XAMPP instead and CLI worked perfectly

Related

Windows 10 - Apache 2.4.53 + PHP 8.0.19 not loading php modules [duplicate]

I have found that:
When I type the following on terminal:
php -i | grep php.ini
I get the output:
The Loaded Configuration file is # /etc/php5/cli/php.ini
However, from phpinfo(), I get to see:
The loaded ini file is # /etc/php5/apache2/php.ini
Which one of these is working right now? How is it possible to have two php.ini files ?
Depends on where you are running PHP from. If you run it from command line, it uses the cli/php.ini and apache2/php.ini when run through apache.
You are executing phpinfo() through the browser, hence you get /etc/php5/apache2/php.ini as the answer. Running php -r "phpinfo();" | grep "Loaded Configuration" from the terminal should output the CLI ini. Same function, context changes.
The advantage of this system is obviously to allow different configurations depending on the context. For a simplified example, you might want to have safe_mode on in apache but it's unnecessary in CLI mode.
Your .ini paths are actually quite unusual. Normally, the default .ini is just php.ini and CLI .ini is called php-cli.ini and they reside in the same folder.
I'm no expert on the subject but this should be the basic idea. If anyone has any corrections, I'd be happy to hear them.

How to automatically resolve `.xyz` extension files to `#!C:\perl\perl.exe` without adding this in first line of them [duplicate]

I have set up a local Perl web environment on my Windows machine. The application I'm working on is originally from a Linux server, and so the shebang for source .pl files look like so:
#!/usr/bin/perl
This causes the following error on my Windows dev machine:
(OS 2)The system cannot find the file specified.
Is it possible to change my Apache 2 conf so that the shebang is ignored on my Windows machine? Of course I could set the shebang to #!c:\perl\bin\perl.exe, that much is obvious; but the problem comes to deploying the updated files. Clearly it would be very inconvenient to change this back on each deploy. I am using ActivePerl on Windows 7.
Update:
I should have mentioned that I need to keep the shebang so that the scripts will work on our shared hosting Linux production server. If I did not have this constraint and I didn't have to use the shebang, the obvious answer would be to just not use it.
I use #!/usr/bin/perl in my scripts and configure Apache on Windows to ignore the shebang line. Add
ScriptInterpreterSource Registry-Strict
to your httpd.conf and set up the Windows Registry key as explained in the Apache docs.
Here is what I get when I export the key:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
#="c:\\opt\\perl\\bin\\perl.exe"
I have been using this setup with Apache and ActiveState Perl on my Windows laptop and the Apache and Perl distributions that come with ArchLinux on my server.
The Apache docs (to which I linked above) state:
The option Registry-Strict which is new in Apache 2.0 does the same thing as Registry but uses only the subkey Shell\ExecCGI\Command. The ExecCGI key is not a common one. It must be configured manually in the windows registry and hence prevents accidental program calls on your system. (emphasis mine)
There is no portable shebang line. Even on the same platform and architecture, someone might have installed perl is a different location.
The trick is to not install modules and scripts by hand. When you package everything as distributions and use the module toolchain, the shebang lines are modified automatically to point to the perl you used to install everything. You shouldn't have to think about these details. :)
I use #! /usr/bin/env perl as the shebang on all of my perl, whether on *nix or Windows. Windows just ignores it, and the Unixen follow env to the chosen perl disto.
The way I had this working was to copy perl.exe to c:/usr/bin/ and rename it to perl (strip the .exe)
In win7 and up you can also do this with the "dos" command mklink.
Start a cmd shell as administrator and do something like the following:
mklink /d c:\usr c:\Perl # Activestate perl in c:\Perl\bin\perl.exe
mklink /d c:\usr c:\xampp\perl # Xampp perl in c:\xampp\perl\bin\perl.exe
Install any Windows Bash flavor (such as Cygwin, MSYS2 or GnuWin32);
Create a trivial redirecting shell script:
exec "#"
Create a registry entry:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command]
#="<path-to-sh> <path-to-script>"
[HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
#="<path-to-sh> <path-to-script>"
[HKEY_CLASSES_ROOT\.py\Shell\ExecCGI\Command]
#="<path-to-sh> <path-to-script>"
(...and so on.)
Jot in your httpd.conf file:
ScriptInterpreterSource Registry
Apache will now resolve Unix shebangs relative to the interpretation given by your choosen Bash flavor. This gives much more flexibility than hardcoding interpreter paths in the registry.
I don't have Windows handy, but perlcritic says:
my $desc = q{Found platform-specific perl shebang line};
my $expl = q{Perl source in parrot should use the platform-independent shebang line: #! perl};
So, I guess #! perl should work.
Edit: doesn't work on linux; apparently works in parrot, although I don't see how they manage that.
How to use Linux shebang (#!/usr/bin/perl) when running Perl based web-site with {site-name} on localhost in Windows 10?
This works for me:
XAMPP on localhost\{site-name} (C:\xampp\htdocs\{site-name})
independently installed Strawberry Perl (C:\Perl\perl\bin) because Perl included in XAMPP package is not satisfactory
In default configuration you must use this shebang:
#!C:\perl\perl\bin\perl.exe -IC:\xampp\htdocs\{site-name}
Is it possible to include directory (after -I switch) permanently to #INC?
Yes, you can do it by setting the PERLLIB or PERL5LIB environment variables. This works when running perl script from command line, but surprisingly it is ignored by apache server in XAMPP. However one of #INC directories (C:/Perl/perl/site/lib) is usually empty so you can make symbolic link to your web-site directory:
mklink /D c:\perl\perl\site\lib C:\xampp\htdocs\{site-name}
Now, you can use this shebang:
#!C:\perl\perl\bin\perl.exe
Moreover, you can create directory c:\usr\bin
md c:\usr\bin
and copy perl.exe from C:\perl\perl\bin\
copy C:\perl\perl\bin\perl.exe c:\usr\bin\perl.exe
(Another mklink trick is not working here from some reasons.)
Finally, you can use Unix-styled shebang on Windows:
#!/usr/bin/perl

Can not load modules/mod_auth_openidc.so : The specified module could not be found

I want OIDC implementation with my application for SSO integration, and getting an error when trying to execute httpd.exe.
I am using windows server 2008 64 bit.
Apache server 2.4.2 64 bit.
I have downloaded mod_auth_openidc.so for 64 bit downloaded from here -
click here.
I have performed these steps:
Step 1.Downloaded apache 64 bit from here -apache_2.4.2-x64-no-ssl.msi.
Step 2.Downloaded mod_auth_openidc-2.2.0-apache-2.4.x-win64.zip from Git hub - click here
Step 3. Unzipped the file and copied the files to bin and modules location of my apache server respectively.
Step 4. Added the LoadModule auth_openidc_module modules/mod_auth_openidc.so in httpd.conf file present in conf folder in apache.
Step 5. Now when I try to run the apache server(httpd.exe) it gives me an error.
error screenshot here -.
error line from httd.conf file from conf folder -.
Please help!
Thanks in advance.
Please let me know if I can answer your any query.
LoadModule uses a path to load a module, if the path is relative, as in your case, it will be relative to the value in ServerRoot directive.
Since you have manually installed this third party module, you probably should define with full filesystem path to it.
Since you say you copied there already, make sure you are pointing to the correct installation.
It may be a compiler issue; I used binaries from: https://www.apachehaus.com/cgi-bin/download.plx
It may also be due to the version of msvcr120.dll:
mod_auth_openidc library requires msvcr120.dll which is the newer
version of Microsoft VC ++. It looks for this file. We used dependency
walker software to see the tree and what are the required files for
the mod_auth_openidc.iso. It showed missing msvcr120.dll file. We had
to update the current vc++ which added this missing dll in the
windows\System32 folder. and we could restart the server.
See:
https://github.com/pingidentity/mod_auth_openidc/issues/275#issuecomment-305302587

Setting up a Fossil server on Apache

I'm trying to set up a Fossil server on an externally hosted Apache server without much luck. I created the cgi script and placed it and the executable in the cgi folder. I don't have access to any directories before the www directory which is considered as my root directory. The problem comes when I attempt to run the script as I always get an 500 internal server error response. Every folder and file has been given 755 permissions.
Can anyone tell me what I am doing wrong?
Here is my script which i named "repo.cgi"
#!/cgi/fossil
repository: /fossils/project.fossil
And this is the url format that gives me the error.
website.com/cgi/repo.cgi
As long as you got "500 internal server error", you have possibly the following issue:
Your web server uses 64bit Linux without 32bit compatibility libraries installed.
On the other hand the official fossil binary is 32bit and compiled to dynamically link some 32bit libraries.
You can fix the problem probably by using the statically linked fossil binary. (I am assuming you can't install the needed libraries on the server).
Download the source code and try to compile it with the proper option. (IIRC "--static")

How to run Apache benchmark load-test in Windows?

what's the procedure I should follow to run a simple test on a domain www.example.com? I'm on Windows environment and have installed WAMP server 2.1.
I actually know which command I should use (Ex. ab -n 1 http://www.example.com/) but don't know where I should type it.
I don't know the path WampServer is installed to, so I'll just show you how I do it under WampDeveloper (which is what I use).
Run cmd.exe.
Inside...
C:
cd \WampDeveloper\Components\Apache\bin
ab -n 1 http://www.example.com/
To answer your question, you type it in the command line changed to the bin folder of your Apache folder since this is where ab.exe exists. If this folder location is in the system path, you can also just type it in anywhere (without changing paths in cmd.exe).
This 1st line changes the drive letter. Then second the path (aka working directory). The third runs ab.exe.
I do agree, PATH ENVIRONMENT setup manually
C:/YOUR_INSTALLATION_APACHE2/bin
Path to environment on control panel system settings.