simpleengine
simpleengine

Reputation: 2832

After installing php on nGinX phpinfo() works but nothing else

After installing nGinX on Ubuntu 12.04, installing PHP and setting up my vhosts to run PHP I created a file called test.php, but only the php info is displaying not the echoed text.

This is the content of my test file

   <?php phpinfo(); ?>
   <?

   echo 'hello php test';

   ?>

Upvotes: 0

Views: 2222

Answers (1)

simpleengine
simpleengine

Reputation: 2832

I hadn't noticed that I switched to short tags while writing this script. After changing my short tags <? to long tags <?php the php echoed the string correctly.

I am migrating a bunch of php files to the new server with short tags, so I needed to enable short tags in my php.ini file.

To do that I updated the following line within the php.ini file

short_open_tag = On

Next I had to restart nginx

sudo service nginx restart

Upvotes: 1

Related Questions