Netbeans Unit Testing - php

I am using Netbeans 7.2.1 and am having trouble with the PHP unit testing component.
I have created a .php file called 'Calculator.php'. When I try and create a Unit test for this file, I get the following error:
'"#php_bin#"' is not recognized as an internal or external command,
operable program or batch file.
Am I correct in saying that the problem is that the path to my PHP.exe is not correct in my environment variables?
Can I please have some help to fix this?
Thanks in advance.
EDIT
I have changed the System Environment Variable as follows:
Variable name: "#php_bin#" and Variable value: "C:\Program Files (x86)\PHP\php.exe"
This however does not fix the problem. Can I please have some help to get this working?

I think you are right, the error deals with the path specified in Enviorment variable, You should replace #php_bin# by the path to the php binary. I guess PEAR or PHPUnit installer was supposed to do that.
check out this Link and follow instructioins.

Related

"Cannot find script file" error but file is actually there

Disclaimer: am beginner.
I'm trying to build this certain PHP extension on Visual Studio Code 2017 in the Integrated Terminal, and I tried using the phpize command (there is an environment variable for the directory). It keeps outputting
C:\xampp\php\ext\php-geos
$ C:\xampp\php\php-src-php-7.2.6\win32\build\phpize
Input Error: Can not find script file "C:\xampp\php\php-src-php-7.2.6\win32\build\phpize.js".
Error generating configure script, configure script was not copied
even though it's right there. The file path is right. I checked the folder.
How can I fix this?
Found the problem: the .js file was actually a .js.in file. I solved the problem by changing the extension, but I guess another solution is to edit phpize and put .in where it is applicable.

which is the environment variables route for cakephp 3?

I recently installed a cakephp with composer to learn about framework use, and trying the bookmarks tutorial, but I get stucked in the checking your installation where you have to open the command line AKA cmd, and writing bin\cake.
It replies back: the system cannot find the path specified.
I've seen some information about how to set up the path variables but I'm guessing it's for version 2+ because apparently the cakephp 3 doesn't have a LIB folder like such:
YOUR_CAKE_DIR/lib/Cake/Console/
Any ideas on how to fix this?
Thanks
best regards!
***************UPDATE**********************
well, I've finally fixed the problem, the path I used for the cakePHP 3 instalation was:
c:\xampp\htdocs\caketest\bin
so I assume that If you aren't using xampp, it should point at the end to: cakeinstallation\bin...
my problem was that I always typed bin\cake but actually all I had to do was type only:
cake
you can read more information in here
bin\cake shouldn't require any special path settings other than being in the correct directory. However, you should make sure that php-cli is on your system's PATH. Depending on how you install PHP it could be in any number of places, but if php -v doesn't output the version of PHP you installed, you'll need to find where your installer put PHP and then setup the PATH environment variable.
With your example, AFAI remember the working directory they were executing cake binary was the parent of "bin" folder, in your case "caketest". I am talking without trying it (I dont have an environment close) you should use:
c:\xampp\htdocs\caketest> "bin/cake"
Watch the quotes. I think they are the main reason of that "the system cannot find the path specified."
I am supossing you are under windows (I saw xampp written in your post) and probably the xampp installation has already added the php folder in the PATH environment variable.

Can't seem to set my php.exe path in pear.bat

I installed PEAR and when I try to run it, I receive this message:
PHP_PEAR_PHP_BIN is not set correctly. Please fix it using your
environment variable or modify the default value in pear.bat The
current value is: .\php.exe
In the pear.bat file that error message is generated as such:
:PEAR_PHPBIN_ERROR
ECHO PHP_PEAR_PHP_BIN is not set correctly.
ECHO Please fix it using your environment variable or modify
ECHO the default value in pear.bat
ECHO The current value is:
ECHO %PHP_PEAR_PHP_BIN%
GOTO END
At the top of the file there is a conditional set like so:
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=.\php.exe"
That's my starting point. I've changed that path to this:
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"
Regardless of the change, I get the same error in the command line, as in it still thinks the value is .\php.exe. I can tweak the error message and my tweaks will appear in the command line so I'm confident this pear.bat file is being referenced.
So my assumption is, based on that condition, "%PHP_PEAR_PHP_BIN%"!="" and if that is the case, where is it being set so I can override it to my correct path? Ideas where I should look or how to troubleshoot this further?
Here's my pear.bat source code: http://codetidy.com/919/
Thanks!
I was able to override the path by removing the condition:
Replaced
IF "%PHP_PEAR_PHP_BIN%"=="" SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"
with
SET "PHP_PEAR_PHP_BIN=C:\hqp\xampp\php\php.exe"
Though this solved my issue, I'd still like to know where that value was being set prior to this file. I confirmed the path was correct in the php_bin value in the pear.ini file as well, of course.
For Windows, must SET "PHP_PEAR_PHP_BIN" under user environment variable to path to php.exe. Like me, I set it to "C:\wamp\bin\php\php5.3.0\php.exe".
This will solve your problem.
For wamp on windows set environment variable as
Go to System>Advanced System Settings.
Then set environment variables as
PHP_PEAR_PHP_BIN
c:\wamp\bin\php\php5.3.13\php.exe
Save
Run cmd and type pear on command prompt.
you shall find it in user variables under environment variables in windows. I was facing the same issue, then changed the value for user variables and it worked.
continuing on in the installation the document at http://pear.php.net/manual/en/installation.checking.php under verify include paths states to run php --ini at the command line. doing this i noticed that Configuration File (php.ini) Path: was set to c:\windows (this is a widows xp machine) I thought this was strange so i went looking for the file to see what was in it. There was no php.ini file but there was a pear.ini file so i decided to look at that. It has to lines in it, the second like is where i found the path. The file read s:7:"php_bin";s:9:".\php.exe" near the end of the line i changed it to s:7:"php_bin";s:9:"C:\php\php.exe" and all was good.
Just thought i would update this as i dont like to change batch files that should not need to be changed.
change the ./php.exe to the actual path eg c:xampp\php\php.
thanks
A simple solution without going withing the environment variable of Windows.
You can edit the PEAR_ENV.reg file available after first installation of Pear. This file should be in your PHP folder. Within this file you will find the following line:
"PHP_PEAR_PHP_BIN"=".\\php.exe"
to
"PHP_PEAR_PHP_BIN"="F:\\PHP5.2\\php.exe"
Change "F:\PHP5.2" to whatever where is you PHP installation.
You can now double-click on the PEAR_ENV.reg file to setup correctly your environment variable.

Symfony project is not work on local pc

I have this trouble: i copy symfony project files on my pc, after that change paths and db settings, and it still not working, even dont tell about errors! Maybe there is some specific actions for setting up symhony on another server?
Almost the same problem How to configure symfony project in local server? but when i try execute "php symfony" it prints "no such file or directory"
There are no any php errors at all.
Using Fedora 15 OS, and apache. php work in command line, symfony is not working. I tried to find out what is happening - inside Controller.class some error, when it use processObjects method, it take 11 objects, and after first of them (header.object.php) it stops.
The white screen generally means symfony can't write to cache and/or log dir, check on apache error logs to see details.
if 'php symfony' on command line throws no such file or directory could mean php is not in your system path.
Please add more information to get answers
myabe, as said below is a permission problem of the caché and log files. Check if they are writable. Good Luck!

Zend_Tool setup problems

hai
I read that to create a project, execute the zf Windows windows command (zf.bat):
C:\>zf.bat create project newproject
I saw zf.bat in my C:\wamp\www\Zend\bin, I want to create a new project in c:\wamp\www
When I tried to run c:\wamp\www\zf.bat, I got an error message:
"zf.bat is not internal or external command, operable program or batch file.."
Then I tried another method:
c:\wamp\zend\bin\>zf.bat create project newproject
But I got the following error message:
"php is not recognised internal or external command,oprable program or batch file"
I put the Zend Framework in c:\wamp/Zend and I added C:\wamp\zend\library in to my php.ini.
Please help me troubleshoot this problem.
Thanks!
You need to add php and the zend framework paths to your system environmental variables:
Right click on My Computer and select properties
Go to the advanced tab, and click on Environmental Variables
In the system variables box, scroll till you find the "Path" variable, select it and click the edit button.
Paths are separated using a semicolon ";". Add the path to the zend framework bin folder, and your php bin folder.
Click ok,ok,ok
You should now be able to use the zf command line tool anywhere you need it by typing "zf" to get the help info and to ensure you put the paths in properly.
Hello you probably need to have php.exe on your path to use zf.bat
try to edit the zf.bat and make sure to use the full path in the script your php.exe is probably located in your wamp directory somewhee

Categories