Ask coding questions

← Back to all posts
1
syntax error. Why I need remove <?php and ?> tags? on repl.it php scripts?
migbara (6)

I'm repl.it user since one year ago. My simple php scripts on repl.it worked well untill a few weeks ago, but now I found this error:

syntax error, unexpected '<', expecting end of file

My php code is:

<?php echo "Hola"; ?>

I have read here that if I remove the tags it works, but, I think that it's an error because if I remove the tags I lost syntax highlighting, and every this was working with tags before.

Please, could you take a look? I need help with this

Thanks

Commentshotnewtop
1
timmy_i_chen (934)

We made some updates to PHP (well, we made two new "languages"):

https://repl.it/languages/php_cli - New and improved PHP language for command line interface shenanigans. Supports multiple files and syntax highlighting.
https://repl.it/languages/php7 - PHP Web servers! Just like other hosted repls, this allows you to write websites using PHP.

Enjoy!

1
Vandesm14 (483)

PHP does not work in repl.it
To use server-side code, try Expressjs
If you already know JavaScript, it will be super easy to learn Expressjs!

Please mark this as answered if I helped your problem 👍

1
a5rocks (501)

@Vandesm14 Oof didn't realize.

I suggest Jinja2 templating engine + Flask, as both are really easy to get into. (i think)

1
migbara (6)

@Vandesm14 PHP works on repl.it if you remove these tags now