• Resolved hbee

    (@heatherbodlak)


    Hi

    I am trying to replicate PHP actions on an updated wordpress site.

    Here https://www.tanatoriossanantonio.com/hoy-despedimos-a/ a plugin that is old is used (exec-php) that doesn’t work with PHP 7.4. So, I have set up a staging site to try and find a new way to maintain the system where our client publishes (and deletes) entries almost daily. They fill out a form that uploads data to a database that is “called” on to that page, to display the information they entered.

    Now, what I am trying is to create PHP code shortcodes to implement in that page, but I am not having luck.

    I tried pasting the entire code into a “universal code fragment”, but nothing appears on the page.

    I get this error for example:

    require_once(): Failed opening required ‘conexion.php’ (include_path=’.:/usr/home/sys/phpfarm/inst/php74/pear/php/’)

    but i don’t know what path it’s looking for.

    I then tried creating smaller PHP fragments, and they aren’t showing up either…

    Do you think this is because it is a staging site??

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support markomiljanovic

    (@markomiljanovic)

    Hi @heatherbodlak,

    From the error and your description, it looks like the main issue isn’t the staging site itself, but how the original PHP code is structured and how it’s being loaded inside WPCode.

    The old setup was likely running a full PHP file directly inside the page, and that file relies on ‘conexion.php’ and possibly includes other PHP files as well.

    When you move this into WPCode as a code snippet/shortcode, a few things change such as relative paths.

    The error: require_once(): Failed opening required ‘conexion.php’
    means PHP is trying to load conexion.php from the current working directory or the default include path, and it can’t find it there.
    In a normal standalone PHP file, conexion.php might be in the same folder, so require_once ‘conexion.php’; works. Inside a WPCode snippet, that file path is now relative to WordPress’ context, not the old plugin/theme file’s folder, so PHP doesn’t know where to find it.

    Thread Starter hbee

    (@heatherbodlak)

    Thank you so much for taking the time to help me with this.

    I will look into the relative paths, moving “connection.php” or seeing if I can find the path that works so PHP can find it.

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

You must be logged in to reply to this topic.