Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - WAMP server

Tags:

php

wamp

I have a problem with WAMP server (2.1); I have some php files that contain php statements between

<? statements ?> 

and the browser don't interprets the code. If I use :

<?php statements ?>

everything works ok.

Any idea how to fix it. Thank you.

like image 673
Bogdan S Avatar asked Dec 28 '22 14:12

Bogdan S


2 Answers

Whether you should or should not use short tags is debatable. I personally do not and I don’t recommend it. That being said — with WAMPServer 2 you can:

  1. Click on the wampserver tray icon.
  2. Go to PHP. Then PHP Settings
  3. Click short open tag. (When it's on it will have a checkmark next to it.)

Using the tray icon (lower right — next to the clock) is the easiest, least error prone way to make any changes in WAMPServer 2+.

like image 170
Herbert Avatar answered Jan 14 '23 01:01

Herbert


As kieran said:

This is a good thread on why you shouldn't use short tags: Are PHP short tags acceptable to use?

If you decided to used them, add in your php.ini:

short_open_tag=On

Documentation for php.ini directives


Be carefull, in a wamp installation, php.ini can be found at multiple locations:

wamp\bin\apache\Apache<version>\bin\php.ini
wamp\bin\php\php<version>\php.ini

Accessing the php.ini from the wamp menu (left click on wamp tray icon / php / php.ini) opens the php.ini of the current apache version.

like image 44
Benjamin Crouzier Avatar answered Jan 13 '23 23:01

Benjamin Crouzier