I installed Eclipse PDT-all-in-one-win32-2.0.0GA and WampServer 2.0.
I try to run as PHP Script in eclipse but I have this error:
"The current debugger does not have any defined PHP executable."
How do I create this .exe ??
Ok But I do not have php.exe. I only create Test.php in my project.
In order to run **.php* files, you will need PHP installed, and because you already have installed WAMP, you should be fine.
"The current debugger does not have any defined PHP executable."
If you have installed WAMP as you said, try to look for php.exe on your local hard drive and then set path in Eclipse that leads to it (eg. c:\wamp\bin\php\php5.2.9-2\php.exe). Go to Window\Preferences\PHP\PHP Executables and add this path to the list.
You do not need to create this .exe
In Eclipse you need to configure the debugger settings. The debugger needs to know where the php.exe file lives.
Edit: php.exe ships with the standard PHP install on windows. When you download PHP from www.php.net you will find the php.exe file somewhere in the directory you installed PHP in.
Hope this helps :-)
Related
i'm trying to set the certain path for the php extension in my vscode (using linux)
i started installing the XAMPP
and after it..i tried to use the extension writing some php scripts(php extension INTELLISENSE and DEBUG), but the extension is not working properly and it's showing that error:
Cannot validate since /usr/bin/php is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable.
i tried to set it using que path which is provided by vscode documentation, but it's still no working.
Can anyone help me !! please!!!
I found a solution, typing in terminal
'whereis php'
that returns the absolute path for set it in the vscode extension
/opt/lampp/bin/php
Then, setting the path in the follow line
php.validate.executablePath: "/opt/lampp/bin/php",
So, I hope this solution is helping someone behind the screen.
Php path in windows
Typing in terminal
where php
And it'll gives the path as (in my case)
C:\xampp\php\php.exe
Just extending the answer by #Reinaldo Duguet with a ton of thanks to him !
If you are using Xampp, the PHP path can be found by running the local server and then typing localhost in the browser. This will open the Xampp dashboard. Click on phpinfo() and there you will get the exact path shown as
Configuration File (php.ini) Path = /opt/lampp/etc
Please note that the path may very as per the PHP installation in your system. So you may have to use the respective path shown with above ways.
Then, to let VSCode know this path, open settings in VSCode and search for "PHP debug" and click on the PHP > Debug:Executable Path setting
Add the following line at the first place after "{" telling VSCode where PHP is installed in the system.
"php.validate.executablePath": "/opt/lampp/etc",
If you are using Xampp, the PHP path can be found by running the local server and then typing
the correct version C:/xampp/php/php.exe
XAMPP isn't the best option for linux and i wouldn't recommend it.
Assuming this is not the problem, here is how to do :
find php executable
whereis php
Check your vscode installation. You want to make sure it's not using flatpak (it runs in a container and it would mess up everything)
go in vscode settings, search for php and set "php.debug.executablePath": "/your path/php"
If it still doesn't work, this might be a permission problem. Then :
copy the php executable in your user folder
sudo cp original_path/php /your_user_folder/php
add permissions
sudo chmod 777 /your_user_folder/php
If none of above worked, at this point, you may want to use a VM.
I just wanted to add a possibility here that ended up being my issue in case it helps someone else in the future. My issue was that I was using a Debian based distro and installed VSCode through the software app which relies on Snap apparently. Snap runs the programs in a sandbox and prevents them from seeing other locations on the computer. My solution was that I uninstalled the shop version and installed VScode manually via downloading directly from the website. After that, everything works as expected.
I'm trying to get my Laravel project to work. But when I use composer update it says the following:
This package requires php >=5.6.4 but your PHP version (5.5.12) does not satisfy that requirement.
I'm using WAMP which runs php version 7.0.4 this is also confirmed in the browser if I echo the php version. But when I use php -v in the console it shows that I'm using PHP version 5.5.12 (cli).
I've searched a bit around on google and I found out that it uses my windows PHP version instead of my webserver's version. But I couldn't find out how to update my PHP version on Windows.
My PATH contents are as shown in the following image
You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.
This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation.
However, you can modify your PATH environment variable as well. Procedure
Just remove the path that points to any PHP installation directory.
Else, otherwise, if you are unsure about changing the PATH variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH variable points to.... (I mean the PHP directory)
The totally better solution is to add the path of your PHP7 bin directory at the beginning of the PATH variable. You should also make available composer in this PHP7 bin directory.
Such as, replace the C:\php in your path with C:\wamp\bin\php7 or whatever the location of the PHP7 path is..
To update PHP on Windows 10.
You must put the folder of the new PHP version in the same folder as the old.
You rename the old folder or you delete it, prefer rename the old folder,
now you write in a terminal console
php - v
PHP automatically check for a new version
if you had installed before xampp/wampp and composer globally you might had added php to you environment path to call it where ever you want, and now you want that composer use the new xampp with php the you recently installed, so go to system>advance tab> environment variable> maybe in PATH then search if you have something like C:\xampp\php and edit to your new php location.
I had multiple versions off xampp for testing and composer globaly instaled for php 7.2
I have an application hosted in a Windows machine that has two versions of PHP installed.
It's out of my control because there is another app of another vendor that somehow needs to use an older PHP version ; my app uses apache and the other vendor's app, IIS. The two PHP versions are installed in different folders, mine on 'c:\app\php' and the other vendor in 'c:\php'.
The problem is , when i go INSIDE the folder my PHP version is located (c:\app\php') and run PHP.EXE in command line, i get this error :
The procedure entry point php_checkuid could not be located in the dynamic link library C:\PHP\ext\somedll.dll
Why is this happening ? I'm calling PHP.EXE in the folder 'c:\app\php', not in 'c:\php'. How to fix that ?
The solution for me was set the PHPRC environment variable to the folder of the correct PHP instance (c:\app\php). Before it was set to the wrong one (c:\php).
To do this search Windows for 'Edir environment variables for your account', look for 'PHPRC' and set it to the correct folder of the PHP instance.
Put in the Windows Environmental Variable 'Path' the path of the php version you want to use.
Copy the complete content of phpForApache.ini to the php.ini file in that folder.
After that open a command window anywhere and type php -v should be working.
Good luck.
When I try to use Webception over wamp server on my windows 7,8 the below error appears for each tests
'php' is not recognized as an internal or external command,operable program or batch file
I have already installed php and the path is correct. Does it need more setup? How I can fix this issue ASAP?
This is because windows does not know where to find the php.exe file as it is not in a folder that is on your PATH environment variable.
However, when using WAMPServer it is a VERY BAD IDEA to add the path containing the php.exe to your PATH in the traditional way, because of course in WAMPServer it is possible to have many version of PHP available within one instance of WAMPServer.
The best solution in a WAMPServer environment is to create yourself a little command file that you can run from within a command windows that will add the php path you want to use for this specific project.
So create yourself a .cmd file and place THAT file in a folder that is already on your windows PATH environement variable.
So for example :-
File = phppath.cmd
PATH=%PATH%;c:\wamp\bin\php\php5.5.12
ECHO --------------------------------------------
php -v
ECHO --------------------------------------------
Of course you can make this as clever as you like and accept parameter specifying the php version you want to run, but untill you actually have more than one PHP version installed this is good enough.
I was also having a problem with webception on wamp failing to find php despite it being available on user and system path.
I found that wamp on windows by default does not provide environment variables to PHP.
I fixed this by editing php.ini (in apache/apache/bin/php.ini)
and ensuring that the following is set
variables_order = "EGPCS"
As at the current webception version 0.1.0 there is a bug to do with path generation that fails tests because the test file cannot be found. There is a solution for this at https://github.com/syntithenai/Webception/
My system is win7. I have installed XAMPP on the system successfully.Besides, I have set the environment variables:
PHP_HOME=C:\xampp\php
Path=%PHP_HOME%
But when i run php code in git bash ,it appears the error:"sh.exe:php:command not found"
How can i solve the problem?
In my case I can solved my problem in this way ...
Go to PHP directory in the XAMPP folder and run the code in this way with the XAMPP server:
$ Php /c/xampp/htdocs/cupon/bin/vendors install
As far as i was trying to execute MSVC compiler from within Java, i got the idea of all that Win7: the shell you are running something has different environment variables that you think you've set.
I recommend you to insall WAMP server - it is totally compatible with Windows while XAMPP seems to be a bit hard way to start with.
And one more hint: try running php / sh from the bin/ PHP directory.
If you're using Windows and getting the "php: command not found" error, it means that the PHP executable is not in your system's PATH environment variable. Here are the steps to fix it:
Find the location of your PHP installation. By default, PHP is installed in the "C:\php" directory. If you've installed PHP in a different location, note down that path.
Add the PHP directory to the system's PATH environment variable:
Open the Start menu and search for "Environment Variables."
Click on "Edit the system environment variables."
Click on the "Environment Variables" button at the bottom of the window.
Under "System Variables," scroll down and find the "Path" variable. Click "Edit."
Click "New" and enter the path to your PHP directory (e.g., "C:\php").
Click "OK" to close all the windows.
Close and reopen your terminal or command prompt to apply the changes.
Verify that PHP is working by running the command "php -v" in your terminal or command prompt. You should see the version of PHP installed on your system.
If PHP is still not working after following these steps, you may need to reinstall PHP or check that the PHP executable file is in the correct directory.