Title: using php in posts (trying to include a file)
Last modified: August 18, 2016

---

# using php in posts (trying to include a file)

 *  [paqman](https://wordpress.org/support/users/paqman/)
 * (@paqman)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/using-php-in-posts-trying-to-include-a-file/)
 * Here’s the deal, I’m using Exec-PHP to be able to run php in some posts. So far,
   I haven’t put too much code in, but it seems to be working fine. Then in one 
   of my scripts I try to use an include, here is the code:
    `include 'http://www.
   mysite.com/path/to/file.php';`
 * Anyway, then I get this error:
 * >  Warning: Unknown(): stream does not support seeking in /usr/local/psa/home/
   > vhosts/mydomain.com/wp-content/plugins/exec-php.php(39) : eval()’d code on 
   > line 2
 * So you’ve seen the code on line 2. What could be the problem?
 * I would like to use a relative path to include that file, but I don’t know how
   to use a relative path in my post. How do I do that?
    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [richsipe](https://wordpress.org/support/users/richsipe/)
 * (@richsipe)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/using-php-in-posts-trying-to-include-a-file/#post-530404)
 * You are receiving a Warning not an error so the code should still work it just
   is letting you know there could be issues. The Warning is to let you know that
   you are not going to get what you think. You will get the server output of the
   file and not the code of the file.
 * The problem is you are including a page with a web url. You need to do one of
   the following to reference the FILE and not the URL:
 *  * use a relative path to the file such as – /home/userid/public_html/directory/
   file.php
    * or use a path such as – include(“$DOCUMENT_ROOT/file.php”);
 *  [tinem](https://wordpress.org/support/users/tinem/)
 * (@tinem)
 * [19 years ago](https://wordpress.org/support/topic/using-php-in-posts-trying-to-include-a-file/#post-530644)
 * I have contacted **paQman** because I want to make something similar but he didn’t
   solve the problem.
 * I found the relative path from my host – but it didn’t work as described here.
   So have ANY of you got this working so please describe exactly what you did, 
   please?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘using php in posts (trying to include a file)’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * 2 replies
 * 3 participants
 * Last reply from: [tinem](https://wordpress.org/support/users/tinem/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/using-php-in-posts-trying-to-include-a-file/#post-530644)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
