Title: Plugin uses plugins_url, should be plugin_dir_path?
Last modified: August 20, 2016

---

# Plugin uses plugins_url, should be plugin_dir_path?

 *  [bivald](https://wordpress.org/support/users/bivald/)
 * (@bivald)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-uses-plugins_url-should-be-plugin_dir_path/)
 * Hi,
 * The plugin uses plugins_url (i.e it tries to download the file over HTTP, instead
   of opening the actual file on disc). This pretty much renders the plugin useless
   if you have strict PHP settings (i.e can’t download files over http via file()).
 * Following code uses the local file, instead of remote:
 * [code]
    $file = 'mime-types.txt'; $file = plugin_dir_path(__FILE__) . $file; 
   $mime_file_lines = file($file); [/code]
 * [http://wordpress.org/extend/plugins/ap-extended-mime-types/](http://wordpress.org/extend/plugins/ap-extended-mime-types/)

Viewing 1 replies (of 1 total)

 *  [lucile](https://wordpress.org/support/users/lucile/)
 * (@lucile)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/plugin-uses-plugins_url-should-be-plugin_dir_path/#post-3392645)
 * Thanks for the tip, it solved the following warnings:
 *     ```
       Warning: file() [function.file]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 40
   
       Warning: file(http://(...)/wp-content/plugins/ap-extended-mime-types/mime-types.txt) [function.file]: failed to open stream: Success in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 40
   
       Warning: Invalid argument supplied for foreach() in /(...)/web/wp-content/plugins/ap-extended-mime-types/ap-extended-mime-types.php on line 42
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Plugin uses plugins_url, should be plugin_dir_path?’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ap-extended-mime-types.svg)
 * [AP Extended MIME Types](https://wordpress.org/plugins/ap-extended-mime-types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ap-extended-mime-types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ap-extended-mime-types/)
 * [Active Topics](https://wordpress.org/support/plugin/ap-extended-mime-types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ap-extended-mime-types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ap-extended-mime-types/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [lucile](https://wordpress.org/support/users/lucile/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/plugin-uses-plugins_url-should-be-plugin_dir_path/#post-3392645)
 * Status: not resolved