0

I am developing for first time a WordPress plugin. I have two .php (file1.php, file2.php). In file1.php I have defined a form with a action to file2.php for upload images. In file2.php I just do a

require_once('./wp-admin/includes/file.php');

but I receive this error

NetworkError: 500 Internal Server Error - http://localhost/wordpress/wp-content/plugins/file2.php

I tried with require_once(), include(), with the entire route, etc. I reviewed permissions, routes and it's correct. I tried the require_once() in file1.php and it works but I need it in file2.php.

Any ideas? Thanks in advance.

Deploying the logs:

require_once('./wp-admin/includes/file.php');

Warning: require_once(./wp-admin/includes/file.php): failed to open stream: No such file or directory in /var/www/html/wordpress/wp-content/plugins/file2.php on line 15

Fatal error: require_once(): Failed opening required './wp-admin/includes/file.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/wordpress/wp-content/plugins/file2.php on line 15

require_once('/var/www/html/wordpress/wp-admin/includes/file.php');

Fatal error: Call to undefined function __() in /var/www/html/wordpress/wp-admin/includes/file.php on line 16

This error is to a WordPress function, so I suppose that it is not the error, it will be another but....

  • 1
    500 is hiding some other error, check logs –  Aug 16 '16 at 22:12
  • @Dagon Yes, sorry. I received this error Warning: require_once(./wp-admin/includes/file.php): failed to open stream: No such file or directory in /var/www/html/wordpress/wp-content/plugins/file2.php on line 6 Fatal error: require_once(): Failed opening required './wp-admin/includes/file.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/wordpress/wp-content/plugins/file2.php on line 6 but it exists, in the same directory and it has permissions so I don't understand the error. – user6205072 Aug 16 '16 at 22:20
  • well that error seems clear –  Aug 16 '16 at 22:20
  • @Dagon maybe not because if I comment that require, the error doesn't appear. I think it is a route error but I said that I tried several routes and nothing. Thanks for the answer. – user6205072 Aug 16 '16 at 22:27
  • Seems Your require path is incorrect... Check http://wordpress.stackexchange.com/questions/116366/what-is-the-right-way-to-include-a-wp-admin-file-in-your-theme – DpEN Aug 17 '16 at 08:17
  • @DpĚN Thx, I've checked several articles, post, etc and my problem persist since 2 days xD so something strange does the .php so I posted here :( – user6205072 Aug 17 '16 at 23:14
  • @VicSeedoubleyew Thank you, that was the solution. – user6205072 Aug 20 '16 at 14:21
  • @VicSeedoubleyew done, but I can't vote yet. I have not enough reputacion :( – user6205072 Aug 20 '16 at 15:09
  • Oh right :) well, some day – Vic Seedoubleyew Aug 20 '16 at 15:19

0 Answers0