# Problem getting PHP to work properly

## Nivlac

I've been trying to get PHP running with apache2 for a couple days now, and I can't figure out what is wrong. 

If i run '/etc/init.d/apache2 module' it shows "php5_module (shared)"

I have added the "-D PHP5" to my APACHE2_OPTS variable.

Everything looks like it should be working, but PHP content renders blank. Also, if I navigate to the server it chooses index.html rather than index.php for the default web page.

Any ideas?

EDIT: I seem to be having the same issue as the guy here https://forums.gentoo.org/viewtopic-t-843920.html, which he solved by 'enabling the redirect'. What is this? I've looked everywhere online and I can't figure out what this redirect is or what he did.

----------

## whig

I suspect a bug in the php script. Sometimes if I have a php script bug - like a missing ; for instance - the script doesn't run and I'm left with a blank page. No error message. Create the tiniest php script and test:

```
<?php print "hello"; ?>
```

Increase the script size slowly with retesting.

----------

## whig

Of course. php.ini has a setting for this: display_errors = On

It is usually Off for security reasons.

----------

## Nivlac

Sigh.... figures lol. I was putting 

```
<? ... ?>
```

 instead of 

```
<?PHP ... ?>
```

. Its been a while. Sorry for the dumb question, but thanks for the response!

----------

## Anarcho

Wasn't there a php.ini setting to also allow only <? ?>?

----------

## tomk

 *Anarcho wrote:*   

> Wasn't there a php.ini setting to also allow only <? ?>?

 

Yes but it's not recommended to use this format if your code needs to be portable:

```
; Allow the <? tag.  Otherwise, only <?php and <script> tags are recognized.

; NOTE: Using short tags should be avoided when developing applications or

; libraries that are meant for redistribution, or deployment on PHP

; servers which are not under your control, because short tags may not

; be supported on the target server. For portable, redistributable code,

; be sure not to use short tags.

short_open_tag = On

```

----------

