3

My sysadmin setup a virtual server using CentOS, PHP and Apache. All seems correctly installed: I get the Apache welcome page, I can find PHP using which php as well as yum list installed *php*.

I can also put a file testing1.html in /var/www/html/ and see html content on a browser.

But when creating a file testing2.php containing <? phpinfo(); ?> I try to access it via browser and get a blank page.

The Apache log says

[23/Oct/2015:09:27:13 -0400] "GET /testing2.php HTTP/1.1" 200 16 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7" 

which doesn't really help me figure out what's wrong.

Folder permissions are 755 and file permissions are 644.

Any suggestions on how to begin troubleshooting this?

2
  • Try putting full PHP tags in the testing2.php file. Also, check the error log, usually found in /var/log/httpd/error_log. Commented Oct 23, 2015 at 13:58
  • thanks, full PHP tags now work--want to convert your comment to answer so i can choose it? Commented Oct 23, 2015 at 14:07

1 Answer 1

3

Looking at the contents of the test PHP file (<? phpinfo(); ?>) I suspect that your php.ini doesn't have short-open-tag enabled.

To fix this, you have two options.

  1. Change the contents of your code to:
    <?php phpinfo(); ?>

  2. Enable short-open-tag in php.ini.

The preferred approach would be the first, in accrodance with PHP:

PHP also allows for short open tag <​? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.