How to make "Find Usages" work with scripts pathed from documen troot

I am new at this. Forgive the newbie question.

References to scripts pathed from document root (src="/path/to/file.php") are not found using "Find Usages". Below I describe a simple example.
I am using PHPStorm (v8.0.2 for mac os x), and i was hoping to use it to clean up a massive codebase, but this problem is a stopper (many scripts contain references to other files/functions/variables).

html/page1.php has

    <script type="text/javascript" src="/some_script.php"></script>

html/some_script.php has

If I run "Find Usages" on some_script.php, it says "        No usages found in Project Files"

How do I make this work (perhaps by informing phpStorm that html/ is my document root?)

Thank you in advance.

1 comment
Comment actions Permalink

OK folks, I found a way to make this work in my test project.

In Settings->Project:test->Directories
I right-clicked html, and made it a "Resource Root".

Now, after File->Invalidate Caches/Restart, it finds the reference to some_script.php in page1.php.


ok this does not fix the problem in my real project. In html/page2, I have:

define('ADMIN_FOLDER', 'admin/');
$admin_folder = "admin/";

    <script type="text/javascript" src="/<?php echo ADMIN_FOLDER; ?>another_script.php"></script>
    <script type="text/javascript" src="/<?php echo $admin_folder; ?>another_script.php"></script>
echo '    <script type="text/javascript" src="/' . $admin_folder . 'another_script.php"></script>



Notice locations of the script are dynamicly printed in different ways. Still, this file is not found on a "Find Usage" of html/admin/another_script.php.
How can I get these to be recognized?


Please sign in to leave a comment.