'"php.exe"' is not recognized as an internal or external command - zend-framework

I am trying to create a new zend project using wamp.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\> cd wamp\www\zendtest*
C:\wamp\www\zendtest>C:\wamp\www\zend\bin\zf.bat create project quickstart*
'"php.exe"' is not recognized as an internal or external command,
operable program or batch file.
C:\wamp\www\zendtest>
I the environment variable path is
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\Program Files\Zend\MySQL51\bin;C:\wamp\www\zend\bin;
Which is the part I think is wrong.

Replace this line in the zf.bat file
SET PHP_BIN=C:\wamp\bin\php\php5.3.4\php.exe

I too have come across the same Error when i started Zend. Here are some ways how to troubleshoot this.
Make Sure the PHP Interpreter Path (For Example, C:\wamp\bin\php\php5.3.8\bin) is set to the Environment Variables Path. Only one PHP Interpreter can be set.
Make Sure your WAMP Folder & the work directory (For Example, www directory) have valid permission set for proper Execution.
Make Sure your Antivirus/Firewall or any other Software is blocking the Access to php.exe. This i said because, in Windows 7 the User Access Control Feature will not allow execution of php.exe from command line.
And i suggest you work with NetBeans 7.2 which has built-in Support for Zend as well as Doctrine ORM. This is much easier. But you will have to execute the above techniques in that too in the Initial State. The Commands can be directly executed from NetBeans Context Menu.

Came across this error on a new installation even if I added the Environement Path to Windows.
If NetBeans is running, you need to start it as these variables are loaded on startup.

Related

What is an appropriate debugging workflow for Powershell Core modules?

My company has a .NET Powershell module, written in C# to allow advanced users to automate tasks in our product. Currently it targets Powershell 5 using .NET 4.6.1. We would like to allow customers using other operating systems to use it as well, and as it has no OS-specific code, porting it was straightforward.
However, I cannot find documentation on a debugging workflow that should be followed. In standard .NET Powershell, this was quite simple and required a one-time setup procedure:
Configure the debug executable to be the Powershell path
Set debug arguments to be a short script that loads the module and if appropriate, executes the function that is being tested.
Hit F5
However, this doesn't work for Powershell Core. Because the project depends on NuGet packages, the module registration fails with a dependency error. I was able to figure out another workflow but it's a bit more obtuse:
Navigate to the project directory
Execute dotnet publish -f netstandard2.0 -c debug
Execute Import-Module ./bin/Debug/netstandard2.0/publish/MyModule.dll
Execute $pid to find the PID
Attach to the PID via Attach to Process in Visual Studio
This works and I have debugged a few issues with this method, but it's not the most pleasant or efficient way to do it. I believe that there must be a better way that is just not well documented.
I originally came up with a script based approach that you can see in this post's history, but what I didn't know at the time was the CopyLocalLockFileAssemblies property which makes the debug directory look like how it used to look when working on .NET Framework. You just need to add this to your .csproj in a <PropertyGroup>:
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
Then, the debugging setup is just the same as any other .NET module loaded into a third party application:
Right click on your Powershell module project and click properties
Select Debug
Set Launch to Executable
Executable: C:\Program Files\PowerShell\6\pwsh.exe
Arguments: -NoExit -Command "Import-Module C:\dev\my-module\bin\Debug\netstandard2.0\my-module.dll"
Set your module as the startup project
Hit F5 to begin debugging.

How to publish a Console Application that uses 3rd party references?

My problem might seem specific, but in fact it is probably very general: How to publish a Console Application that uses 3rd party references?
I am using Visual Studio 2015 to make a Console Application called Gdx2PostgreSql programmed in Visual Basic. The application is reading data in a Gdx-file (output from a GAMS program, www.gams.com) and writing the data to a PostgreSql database. The interface to PostgreSql is handled by NpgSql, www.npgsql.org. NpgSql is referenced as
\\dtu-storage\hela\Documents\Visual Studio 2015\Projects\GDX to PostgreSQL 2\packages\Npgsql.3.1.7\lib\net451\Npgsql.dll
The program functions correctly when it is executed in Debug mode inside Visual Studio.
I have to be able to run the program from the command prompt in a CMD window. Moreover, I have to be able to run the program by spawning from a GAMS program using the GAMS syntax
Execute 'Gdx2PostgreSql "FileName.gdx" "CaseName"';
I have published the program and run the setup file installing the program. But when I run it in a CMD window I get the error:
'Gdx2PostgreSql' is not recognized as an internal or external command, operable program or batch file.
I get the same error message when spawning from my GAMS program.
Being rather desperate I have tried renaming the file setup.exe in the Publish-folder to Gdx2PostgreSql.exe. When I use this file I get:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Npgsql, Version=3.1.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' or one of its dependencies. The system cannot find the file specified.
That is, NpgSql is not known to the program.
As I see it, I need to have one EXE-file that holds all what is needed - especially because my program should be able to run on other PCs, too.
Can anyone help me make my program Gdx2PostgreSql function?
Finally, I should mention that I have made other programs reading Gdx-files and using NggSql to write to PostgreSql. These programs function correctly, but they are Windows Forms Applications – and not Console Applications.
Console applications aren't really any different from winforms applications - you have to distribute the EXE along with any DLLs it depends on - in the same directory. As mentioned in the comment, after building your program you should be able to find everything you need under bin/Debug (or Release).
Regarding why your Gdx2PostgreSql isn't being found, that's likely a problem of path - try running your program with an absolute path, or cd'ing into bin/Debug (or Release) before executing it.

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\

Correct deployment tool to copy files & run SQL Script

What would be the best way to deploy upgrades to a piece of software with the following requirements:
The upgrade:
Must be run from a client machine, not a server.
Must Show a dialog to select a network location and copy files to a share.
Must show a dialog to enter SQL Server connection information and the upgrade must connect to SQL Server to run an upgrade script.
Must not change anything on the client machine from which the upgrade is run. (Nothing in Add/Remove programs, registry, etc. I.e. no Windows Installer.)
Must not rely on any additional dlls or frameworks. The user must be able to download a single file and run it from Windows XP SP2 without having to install anything else.
Some things I have looked into:
Batch files (can’t show a dialog to allow the user to enter connection information)
OSQL (can’t show a dialog and can’t copy files)
WiX (runs on top of Windows Installer so it puts things on the client machine from which it is run)
Custom C#/VB app (requires .NET framework)
Winzip/WinRAR (can't show a dialog, can’t run SQL Scripts)
If you don't want to rely on any dlls and frameworks, you should make a native app, this can be, for example, custom winrar sfx (you can run additional scripts after extraction, this can be a batch that executes sqlcmd).

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.