3

I have been working for 6 hours trying to get my standard core functions of PHP working with Eclipse 3.6 and PDT 2.2.1. For some reason, functions like echo, empty() and isset() come up on code completion, but functions like strtotime() and array_push() do not, even when I push CTRL+SPACE. Also, the function mysql_connect() comes up in the code assist, but mysql_query does not.

I have looked in several google search results and stackoverflow Q&As and found many solutions similar to this one:

Code completion/assist for built-in PHP functions in Eclipse PDT

I have made sure that my .buildpath looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
    <buildpathentry external="true" kind="lib" path="/Applications/MAMP/htdocs/harvestopia"/>
    <buildpathentry external="true" kind="lib" path="/Applications/MAMP/bin/php/php5.3.6"/>
    <buildpathentry external="true" kind="lib" path="/Applications/MAMP/htdocs/yharvestopia/YiiRoot/framework"/>
    <buildpathentry kind="src" path=""/>
</buildpath>

My .project looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>harvestopia</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.dltk.core.scriptbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.maziarz.yiiclipse.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.php.core.PHPNature</nature>
        <nature>org.maziarz.yiiclipse.nature</nature>
    </natures>
</projectDescription>

My .settings/org.eclipse.php.core.prefs looksl ike this:

#Sat Nov 05 00:40:34 MDT 2011
eclipse.preferences.version=1
include_path=1;/Applications/MAMP/htdocs/yharvestopia/YiiRoot/framework

I am really banging my head against the wall and can really use some advice.

UPDATE: Without Yiiclipse, it still doesn't work. I created a new project in a new workspace called Test. The files look as follows but still do not allow for code assist on standard functions.

.project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>test</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.dltk.core.scriptbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.php.core.PHPNature</nature>
    </natures>
</projectDescription>

.buildpath:

<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
    <buildpathentry kind="src" path=""/>
    <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

.settings/org.eclipse.php.core.prefs:

#Sat Nov 05 09:38:26 MDT 2011
eclipse.preferences.version=1
include_path=0;/test
3
  • If you create a PHP project without Yiiclipse, is it the same behavior? Commented Nov 5, 2011 at 10:21
  • Yes. Even without Yiiclipse it is the same problem. Creating a new project on a new workspace also creates the same problem. Commented Nov 5, 2011 at 15:37
  • I updated this such that it shows what the files look like without Yiiclipse, and still not working. Commented Nov 5, 2011 at 15:43

3 Answers 3

2

After 6 hours, I figured out something that works. I have no idea why this works, but it probably has to do with dependencies and other junk I don't understand right now.

What I did:

1) Uninstall Yiiclipse (left PDT installed) 2) Deleted all files out of my workspace 3) Created a new PHP project, for example "blog" in my web root 4) Using the yiic script, I created the new webapp in the blog folder 5) Opened Eclipse and refreshed the project. 6) Right clicked on the project->Build Path->Configure Build Path 7) Click on Link Source... 8) Linked to folder location webroot/YiiRoot/framework 9) Select "Update exclusion filters in other source folders to solve nesting"

Everything worked as intended.

Sign up to request clarification or add additional context in comments.

1 Comment

Thx!!! It helped me also. I just removed yii, restarted eclipse & clean all projects.
1

I found that installing PDT as dependency of yiiclipse cause the same problem (probably not all dependencies are included into yiiclipse). But if you uninstall yiiclipse, install PDT SDK plugin (from indigo updatesite) and again yiiclipse - code completion for std library functions works fine.

1 Comment

Tried that...didn't work...maybe it is because I am using the all-in-one solution provided by the PDT people?
1

I solved simply in this way:

Right click on you project in the project Explorer and select

Configure » Add PHP support...

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.