Include path of php.ini ignored by Eclipse - eclipse

I have a PHP script to run. If I run it from the command line, it works fine (include path is set correctly).
If I want to run it inside Eclipse (Run as script), then the PHP include path of my php.ini is replaced by Eclipse, with all the libraries I've added to the project.
I've configured my PHP executable in Eclipse. I've set the correct PHP executable file, and I selected my php.ini file too (the right one, I've checked). But it is ignored...
Edit : this is an Eclipse bug :
https://bugs.eclipse.org/bugs/process_bug.cgi

Wouldn't manually re-adding the old paths using
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
in the first line of the script you're running work?

Could you add the current php include path as a linked folder within your project, in order to reference that linked directory in the PHP include path?
alt text http://files.zend.com/help/PDT/include_path_properties.png
That way, even if your path is replaced, it will be replaced by:
your path
all the other librairies

This is a bug of Eclipse, 3 bugs have been filled about it but none of them got fixed.
No solution without modifying your PHP files.
https://bugs.eclipse.org/bugs/process_bug.cgi

In Eclipse for PHP Cli Applications
1) Click on Project Properties
2) Click on Include Path
3) Add external folder and/or Source and/or Libraries
After doing such I was able able to run my programs. If I didn't do the above I was having to use the function
set_include_path(get_include_path() . PATH_SEPARATOR . "c:\PHP\PEAR"); etc...
For PHP Web applications I wasn't having issue because I put my include_path var in the Apache2 vhosts file along with my configuration.

Related

PhpStorm PhpUnit via phar autocomplete not working

I have PHPStorm 8.0.1.
PHPUnit is installed via PHAR archive like:
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/bin/phpunit
PHPUnit works via cli:
user#pc:/usr/bin$ cd ~
user#pc:~$ phpunit --version
PHPUnit 4.3.5 by Sebastian Bergmann.
I followed the instructions from JetBrains website https://www.jetbrains.com/phpstorm/webhelp/enabling-phpunit-support.html#d298258e897
In PHPStorm File->Settings tab PHP/PHPUnit
the radio button Path to phpunit.phar is checked
and value is set to /usr/bin/phpunit
I have a file with a test defined like:
class MyTest extends PHPUnit_Framework_TestCase {
...
At this point PHPStorm marks Undefined class PHPUnit_Framework_TestCase
I've restarted PHPStorm and Computer, but still have the same problem.
I've also tried adding /usr/bin to include path (right click on external libraries in project view, and choose option Configure PHP include paths) without success.
Here's the config for PHPStorm Settings, tab PHP (if it matters):
PHP Language level: 5.5 (finally, generators, etc.)
Interpreter: PHP 5.5 (5.5.9-1ubuntu4.5)
Include path is empty
In order to have a PHAR archive indexed by the IDE it has to have a .phar extension (that's a requirement).
The easiest solution is to place phpunit.phar somewhere in your project (usually it would be PROJECT_ROOT/vendor/ folder).
If having local copy inside the project folder is not desired (for whatever reason; although Composer and other similar kind of tools (bower/npm/etc) are primarily aimed at keeping dependency stuff/packages locally), you may use symbolic links:
either create a symbolic link to that file locally (e.g. PROJECT_ROOT/phpunit.phar --> /usr/bin/phpunit)
or place a full copy (or such symbolic link) in a separate folder outside of the project and then reference it via PhpStorm's Settings | PHP | Include Paths functionality.
The above fix by Calin worked for me too on PhpStorm 2019.1.1, so I'll post it as an answer for easier visibility:
Try right clicking on the .phar and clicking "Exclude phar from project", then clicking "Include phar into project" to refresh it.
In my case, both the .phar file and my .idea folder were pulled from a git commit. I guess PhpStorm didnt realise that the file needed reimporting.
I noticed even though PHP itself can find and run phar that is in its include path, PHPStorm having trouble finding and parsing them.
LazyOne's explanation is correct, however, I didn't need to put it in project folder to be recognized, you can put them in any path as long as its path is introduced to IDE. In my case, I put all phar files in PHP folder, so I just needed to add PHP folder to Include Path list in IDE
Include Path for PHP is under Settings -> Language & Frameworks -> PHP screen (that tiny + at the bottom of screen).

How to use SASS with Netbeans 8.0.1

I'm trying to use SASS in Netbeans 8.0.1. I have Ruby and SASS set up correctly based upon the feedback from ruby -v.
I have a web application set up with css and scss folders under Project\Web Pages\resources.
My input and output are set to /scss and /css respectively and I have checked 'Compile Sass File on Save'. I have created a styles.scss file and added some SASS/CSS.
When I save the styles.scss file, is it supposed to generate a styles.css? Nothing happens when I save or compile the project.
Has anyone run into any similar problems or have suggestions on how to debug this problem?
Thanks in advance!
Installing SASS on Windows10, Ruby2.2.3, Netbeans8
Download SASS for Windows - RubyInstaller.org
Install Ruby like:
Search windows for CMD (Command Prompt) and start it.
Access Ruby's bin folder using cd \Ruby\bin (Hit Enter)
Install sass using the command gem install sass (Hit Enter to install)
Wait for the installation to finish
In Netbeans open
Options → Tools → Miscellaneous (HTML/JS in v8.1+) → CSS Preprocessors tab
Enter the path to the installed sass.bat C:\Ruby\bin\sass.bat than click Install Sass.
Confirm your changes with Apply / OK
Use an existing one or Create a New Project (HTML5, PHP, whatever...).
After the project is created open the Projects window.
Right-Click your project and choose > Properties.
From the Project Properties popup select CSS Preprocessors.
Select the Compile SASS Files on Save.
(If you want the compiler to automatically minimize your .css result file, use --style compressed under the Compiler Options)
You can see from the image above that the compiler uses two default Input(watchable)/Output(compiled destionation) folders paths.
Create the scss folder (an optionally the css folder) in your project as well.
You're done!
As soon you create a new .scss file or you save it Netbeans will automatically compile the file to .css in the /css folder.
Yes, when you save the file, the css should be created/updated. I think you have wrong mapping for the input/output directories. The paths need to be relative to site root/web root. I don't know for sure what your project is (HTML5 or PHP or Java Web or other?), but if you have Java Web project, then the paths need to be
resources/scss -> resources/css
Salam guys, the below image form my (Command Prompt with Ruby) says that:
"Ruby Sass has reached end-of-life and should no longer be used"
For modern SASS and Netbeans we can just use https://github.com/sass/dart-sass/releases/tag/1.56.1 and install it in our PATH.
The release has the sass.bat file we need (as Roko C. Buljan pointed in his tutorial for Ruby).
There's not need to install Ruby and any other environment.
I applied this on Netbeans 15

zend framework installation on xampp

I am completely begginer with ZEND FRAMEWORK. I tried to install but was getting some error.
As I go with the zf#1 version installation.
I extracted my folder to the path. C:\xampp\php naming it as zendframework.
I edited my php.ini file's include_path as include_path = ".;C:\xampp\php\PEAR;C:\xampp\php\zendframework\library"
Restarted Server.
Run cmd with path C:\xampp\php\ (where my exact zf.bat files)
Running command zf show version ended with zf error that my zend framework should be in include path.
How to resolve this error?
Is issue is resolved my next command zf create project zend_blog is correct?
How to create project with zf1 and zf 2 ?
Follow the given Instruction Below.
• Go to ‘My Computer’ > Properties > Advanced Tab > Environment Variables.
Environment Variables box will open, View SYSTEM VARIABLES,
scroll the list to ’ PATH ‘ > double click ’ PATH ‘ .
Add the following line to the end of the PATH C:\xampp\php
Zend Framework
• Extract the Zend Framework files to C:\xampp\php\zf.
• Edit the php.ini file. You will find it at C:\xampp\php\php.ini.
Find the line that says ’ include_path ’ and edit the line:
Windows: “\path1;\path2″
include_path = “C:\xampp\php\zf\library”
• Open a shell and cd to C:\xampp\htdocs folder and type this:
C:\xampp\htdocs>C:\xampp\php\ZendFramework\bin\zf.bat create project testproject(project name)
• Now Copy the Zend Folder from your ZendFramework folder ( C:\xampp\php\zf/library /Zend) into the library folder of your new test project ( C:\xampp\htdocs\testproject\library\Zend
it has nothing to do with XAMPP. Something is not configured right or not correct privileges.
See these:
Setting up the CLI tool on Windows
Also, see this thread
You can also consider using NetBeans IDE, it has great support for ZF tool. Check it out this tutorial.
you need to put the zend framework path and the php.exe path into your windows path variable in order to run commands from the command line. This is important in ZF1 so that Zend_Tool will work at the command line or in Netbeans or other Ide's.

zend framework not setup in netbeans

I am haveing problem to setup zend framework into netbeans.
I have assign all setting in netbeans:
Tool>Options>PHP>Zend>
I have put the path of zend directory where I have extract the zend framework directory.
and >Tool>Options>PHP>General>
I have put the C:\xampp\php\php.exe in php 5 Interpreter
And give Global Include Path :
c:\xamp\php\PEAR
and
c:\zend\library\zend\
Also
I have set path in environment variable for php : C:\xampp\php\php.exe
and
in php.ini :
include_path = ";C:\xampp\php\pear\;C:\ZendFramework-1.11.12\library;"
My configration:
Window 7
xamp1.1.2
ZendFramework-1.11.12
Netbeans 7.1
Please can any one help to me?
In Netbeans, Tools > Options > PHP > Zend > is the path to zf.bat, like: C:\Zend\ZendServer\share\ZendFramework\bin\zf.bat.
Don't forget to select the register provider button after you change this value. This is the setting that controls how Netbeans interacts with Zend_Tool.
Netbeans Global Include Path : c:\xamp\php\PEAR and c:\zend\library\zend\ the global include path in Netbeans is only used for Netbeans modules like for autocomplete.
You windows environment PATH variable needs to point to the Zend Framework /bin like: C:\Zend\ZendServer\share\ZendFramework\bin as Windows also needs to know about zf.bat but really doesn't need the library location.
php.ini does need the location of your ZF /library folder. Just make sure this is the php.ini used by Apache at a minimum. Sometimes you'll have 2 php.ini files: one used by Apache and one used by php cli (command line interpreter). Every server setup seems to be different as regards to where the php.ini files are so plz check the documentation and phpinfo() can probably help.

created project appears in php dir

I try to create a zf project but the project appears in my php dir.
I use zf version 1.9.2
I have the zf.bat and zf.php copied to:
k:\xampp\php\zf.php and k:\xampp\php\zf.bat
I use windows xp.
But it creates the project in my php dir in stead of in my webroot.
Any idea's?
You have to invoke the command from the folder you want to create the project in. This would look something like:
k:\xampp\htdocs> zf create myproject
In order to be able to use the client script from everywhere in your folder structure you have to add zf.bat to your system path.
If you don't know how to do that I recommend Redmond Path which lets you manage entries in the system paths with ease.
The easiest solution is to copy and the paste the project :) easy isn't ?
What i think is probably the better solution:
Put your php.exe and zf.bat in your path (SYSTEM PATH) so you can execute its command from anywhere you like:
Go to system properties -> advanced tab -> environment variables button ->
then choose the "path" form system variables and add the path to your PHP.exe and ZF.bat
Looks something like this
D:\wamp\bin\php\php5.2.6;D:\Workspace\Zend\ZF\bin;D:\Workspace\Zend\PHPUnit
DONT forget to add the ";" between every executable ! .
once you did this .. and form your webroot dir you can execute any ZF Tool Command you like