Getting PHP Parse error on Virtual Server
So I set up a virtual server on Ubuntu.
I uploaded a webpage in PHP which had no errors on the another Ubuntu server and on my local computer but for some reason shows a parse error on the Ubuntu Virtual server. So I'm wondering what the possibilities are for causing this error because I know for a fact the webpage has no errors unless different Ubuntu versions have different set of rules. Because the other OS I tested the webpage on is a slightly different linux distribution but same PHP version that is PHP7. |
Quote:
Post your script along with the actual errors and some details, and we can try to help. But based on what you posted, there's nothing we can tell you. |
There are many possibilities and all we basically know is there is something different between the two environments.
Something is not installed, installed incorrectly or configured incorrectly. PHP is not configured correctly. Apache or whatever web server is running is not configured correctly. You will need to go back and reexamine the error and your script and hopefully it will become obvious why it isn't working as expected. |
Quote:
just wanted to confirm. PHP Parse Error: syntax error unexpected '}', expecting end of file in /var/www/file.php I'm using the latest version of ubuntu which is 19. |
Quote:
|
Sometimes it is <? instead of <?php
Edit: <? often works; <?php always works |
Quote:
|
Quote:
|
Quote:
|
To be clear: <? often works (depends on a php.ini setting); <?php always works
|
Finally found the error now folks, thanks a lot yeah.
It was this demon here <? that I had to change to this <?php Though I don't understand why some linux version treat the matter differently. |
Quote:
And the answer to that is in the previous post. |
It depends on distribution / version if the short open tag <? is enabled or disabled by default. Although I had read that with version 7.0 it was deprecated although from the posted PHP page it has not.
|
All times are GMT -5. The time now is 11:40 AM. |