I am trying to setup Symfony2 with PHPStorm 7.1.3 using these instructions but I am running into an error when i execute php app/console server:run.
The error I see is
[InvalidArgumentException]
There are no commands defined in the "server" namespace.
This is what my development machine has
WAMP: 2.5
PHP : 5.5.12
OS : Windows 7
So after getting this error I went to google to do some search and saw many people who had similar problem were using PHP 5.3 and the command line was built for PHP5.4 on wards. I then installed a new version of WAMP which came with PHP 5.5.12 assuming and hoping the error to go away and let me move on to development but then I got the same error again. Now something tells me may be I did not configure something right so I went to see the PHP settings and all seems fine to me.
I am not sure what else to do to get it to work, I will really appreciate if anyone can guide me in setting up Symfony2 with PHPStorm.
UPDATE:
I ran a command php -v to double the php version and it says PHP 5.3.13
You are clearly using Terminal and not Command Line Tools (CLT). The manual you are referring to was made for older version where terminal was not yet available and it refers to CLT (which you are NOT using).
Since you are using Terminal, make sure that your system-wide PHP is actually v5.5. You can verify this by executing php -v command.
Terminal and "Command Line Tool Support" plugin are two different things. First is the same as your real console/terminal (e.g. cmd.exe on Windows) .. while second is some custom emulator (don't know better word/term) which can use PHP Interpreter from PhpStorm settings if configured accordingly (as per manual).
If you want to use Command Line Tools:
It is located at Tools | Run Command... .
Make sure that you have created php alias (as per that manual) so it refers to currently select PHP Interpreter from IDE settings. Otherwise php command may fail. Aliases can be configured at Settings | Command Line Tool Support.
If you want to use Terminal:
You have 2 choices here:
Use FULL path to correct php.exe instead of just php
Make php v5.5 default system-wide. For this you have to:
Alter your PATH environment variable (My Computer | Right click | Properties | Advanced System Settings | Advanced | Environment variables...) and place folder where correct PHP 5.5 is located in front of the list
Restart IDE (most likely will be required) so it picks up these changes to environment variables.
Related
I am trying to run a seed command for an application but windows power shell runs it with PHP 5, when the app is running on PHP 7. I need it to run that one command assuming php as version 7, that is, without changing the version of PHP powershell is using permanently.
I have tried all the solutions I've managed to find online, but unfortunately the majority of them are targeted to Linux systems, not windows.
This includes:
editing composer.json/lock;
defining an alias of php pointing to the path of the version 7 and using it to run the command;
altering the PHP version using PHP manager in IIS
Among others.
Is this a possible thing to do? No matter what I do, my seed command always assumes php5 as the one to use, which results in several "syntax" errors namely complaining about the double question mark "??" null syntax only introduced in PHP 7.
First of all you must have php 7 installed.
Then in windows:
Go to Control Panel and open the System icon (Start → Control Panel)
Go to the Advanced tab
Click on the 'Environment Variables' button
Look into the 'System Variables' pane
Find the Path entry (you may need to scroll to find it)
Double click on the Path entry
replace your PHP 5 directory path with php 7 path)
Press OK
Open terminal again and try again.
You could use different version of PHP in IIS side by side.
IIS support to specify different version PHP-CGI.exe for each sub-application or folder by following steps.
https://learn.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis
You could map PHP5 as global Version and create a sub-application to handle the specific Powershell script, then set module mapping to PHP 7 for this sub-application's handler.
So that the specific page with PHP 7 will not interfere global application.
The way I solved it was by adding in my script files "set PATH=C:\Program Files\PHP\v7.0" before the instructions.
Also needed to add in my environment variables the parameters to accept CMD commands in Powershell.
This was my script file:
set PATH=C:\Program Files\PHP\v7.0
cmd "/C php artisan (...)
I am using eclipse oxygen for php developers, trying to run php project with version 5.6.
Installed php version: 5.6
PHP version in project facets: 5.6
I tried to follow the the below tutorial, however I could not find php -> interpreter in neither project level nor workspace level.
https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.wst.server.ui.doc.user%2Ftopics%2Ftwinstprf.html
How to resolve module(project?) version complaint?
I run in the same problem when I tried to run/debug a PHP project via Run As -> Run On Server.
Since you have not developed in detail your case I will try to present my case such that you might understand what might cause the problem and how to fix it.
So what I did was to choose the Run -> Run As -> Run on Server menu when a wizard-like dialog box was shown. I choose the PHP's Built-in Server, specified a PHP installed executable (like 5.6) then in the next screen ("Modify the resources that are configured on the server") by trying to move my project from the "Available" list to the "Configured" list I've got a notice error like the one you mentioned in the title. In my case the project was configured with PHP 7.1 while the PHP executable chosen in the "Run on Server" dialog box was 5.6, thus the conflict.
So the problem is that your project is defined to be validated by one PHP version while you are trying to run/debug it with another PHP version. What you can do to fix this is one of the following:
either choose a PHP executable for your "Run on Server" session that is compatible with the project's PHP version; this can be done easy right in the "Run on Server" screen .
either configure your PHP project to be validate by the same PHP version as the one you are trying to run/debug your project with; this can be done by right-click the project -> Properties -> PHP -> Validation then choosing the right PHP version
I hope it helps.
Using phpinfo() in my browser, I see that my PHP version is 5.4.21. However, using "php -v" at a command line prompt, my PHP version reads 4.4.9. I'm not the original PHP installer on this server, so I'm not sure why the mismatch. However, I need the command line version to match (or at least, be close) to my browser version.
Is there a way I can update my command line PHP only? If so, can someone point me to a solution?
I've found similar posts here on SO but none with my particular question and needed solution:
different version php on command line and in apache
PHP Command Line & Browser Returning Different Results
Use 'where php' (windows) or 'which php -a' (rest of the world) to get the location of the php-binary you are using with the commandline. If the 5.X version shows up as secondary entry, one may consider deleting 4.x (after making sure, you have a backup around and ini-files are not shared between both versions). If it does not, modify your PATH to include the 5.5 location prior to the 4.X version (or delete/upgrade later)
This implies that you use php direclty without specifing a location.
If one of the versions is installed using the packet-manager of your choice, go check out their documentation before performing any steps.
How does the PHP that MAMP uses run differently from the PHP installed on my Mac?
For example, if if place an bare "phpinfo()" file and access it through my browser into MAMP/htdocs .. the information supplied is my MAMP PHP setup, correct?
But if I terminal into that same folder and "php -i" from command line, I will get the details of my Mac's "system" PHP, correct?
So does that mean that extensions must be separately installed into both setups? Do they need to be managed as 2 completely separate entities? Any PEAR packages installed via command line will not be available to MAMP? If I want to keep the two synchronous I must "double" everything?
All user-installed versions of PHP are installed into a separate folder, keeping the original install of PHP intact. MAMP is only set up to use its version of PHP in the browser.
You can change this behavior by updating your PATH to use MAMP's version, if you don't care about the stock PHP version (which is fairly old). You can do that by adding the following line to your ~/.bash_profile (don't forget to double-check the exact path, so you get it right):
export PATH=/Applications/MAMP/bin/php5/bin/:$PATH
This will make all references to PHP use MAMP's version.
If you need to use the stock version of PHP for whatever reason and don't want to do the above, then you can create an alias. More details for creating command line aliases can be found in this related SO post.
I installed a plugin for NB 7.0.1 which enabled CodeIgniter but when I went to create a project using it, I was told I need to specify a PHP interpreter for Netbeans. I tried to do this using the php.exe you get with Xampp but I get a Java null pointer error. I can't seem to fix this but I'm thinking, why do I need an interpreter on Windows when the Linux machine can do that? I have already set this up on the VM.
Any advice from here? Thanks a lot!
I am using NB 7.1.1 and had similar issue with CodeIgniter plugin when creating a new project. NetBeans would complain No PHP Interpreter was defined in Tools->Options->PHP General. It would not enable finish button so a New Project could not be setup.
I just created a dummy batch file called nb_cli.bat and pointed NB to that for the PHP interpreter. I don't plan on executing (or debugging) CodeIgniter CLI code on local machine so that file will likely never get executed.
If you want to debug or run php locally, make sure xammp works OK outside of NetBeans. But if not, this fix should get you by the NetBeans issues.
I have a separate linux server on my local network for development as I don't need apache/php locally when I use multiple machines for dev/testing/etc.
NetBeans should bugfix that by downing that PHP Interpreter message from an Alert preventing project setup to a warning that No PHP interpreter is defined (or found) so CLI testing may not function.
As an alternative, if you have a linux box with NB installed, you can create the New project there and copy the whole folder (including the nbproject folder) to your PC and you should be able to get by having No PHP Interpreter defined.
Hopefully that gets you going with NB and CodeIgniter. If you need additional details, just ask.