My question is this:

I'm trying to practice PHP. I use OpenElement as my editor. You can get to know this program through this website: https://www.openelement.com/ Problem is: when I preview the page (with PHP in it) it doesn't display text produced by PHP, but instead it produces the PHP code itself. Do you know OpenElement, and if you know it, do you know how to make it run PHP the way PHP should ben run?

Thanks,

Leon (joh)

Dani AI

Generated

Short answer for : PHP is a server‑side language, so if your preview shows raw PHP source the file is being served without a PHP interpreter (for example opened directly in the browser or via a preview that doesn’t run PHP). Good call on spotting the syntax error (missing $) — that explained your parse error. To actually execute PHP you must view the page through a PHP‑enabled web server (local or remote). (php.net)

Quick, practical local checks you can run right now:

  • Create a simple test file named phpinfo.php in your project folder:
    <?php
    phpinfo();
    ?>
  • From that folder start PHP’s built‑in server:
    php -S localhost:8000

    Then open the test page in your browser (e.g. localhost:8000/phpinfo.php) — if you see the PHP info page, PHP is running and your editor/preview was the issue. If you prefer a packaged local stack, install XAMPP/WAMP/MAMP and put files in the server document root (htdocs/www). (php.net)

When publishing to your host (the FTP/403 problem): verify you are uploading to the correct web root (commonly public_html, www or htdocs), use SFTP if the host requires it, and confirm FTP credentials/mode (passive vs active). Check file ownership and permissions (directories typically 755, files 644), and temporarily rename any .htaccess to see if rules are blocking access. If uploads succeed but the browser returns 403, create phpinfo.php on the live site to confirm PHP is enabled; if that fails, contact the host (they can check server logs and ModSecurity). These are the usual causes and fixes. (digitalocean.com)

Note: correctly pointed to OpenElement’s publishing settings — make sure OpenElement’s publish profile points at the correct remote path and uses the right protocol (FTP vs SFTP). If problems persist after these checks, capture the FTP log and the exact 403 error text and ask the host to review the server error log.

Recommended Answers

All 4 Replies

Additionally:

OpenElement allows you to preview pages with a webserver function. This way it works a little bit, not completely. By publishing the pages on a domain it doesn't work at all. I suspect that this has to do with the FTP function.

Help

With this code:

echo( "Hello universe" );
for( n = 0; n < 5; n++ ) {
    echo("A");
}

With 'preview' I get this:

Parse error: syntax error, unexpected '=', expecting ';' in E:\Web\OpenElement PHP\index.php on line 22

And when I upload the code, I get this:

Forbidden
You don't have permission to access this resource.

Which has to get to do with uploading through FTP. I think I'lll solve that one myself.

The cause of the problem was: no prefix. n should be $n. So that's that with the code.

Problem 2 is: I can't upload the files to an FTP server.

Help

I haven't used this program myself, I would go through this guide on the Openelement Wiki:

PHP code is a scripting language ran on the webserver(Pre-Hypertext Processing, IE it processes Hypertext(HTML) before it is sent to the browser), so you will have to upload it to the webserver to run the PHP script. Open Element probably is just missing the FTP settings so it can connect and upload the files to the right folder on the server and then it will also need to know what the actual web address is to view the processed file after it is uploaded.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.