When I use my php, and code it and such, for some reason when I use '<?' my php doesn't work. And I need it to go like that because I download a lot of scripts other people made and most of them don't use '<?php'.

Can anyone help??

Recommended Answers

All 6 Replies

When I use my php, and code it and such, for some reason when I use '<?' my php doesn't work. And I need it to go like that because I download a lot of scripts other people made and most of them don't use '<?php'.

Can anyone help??

on your php.ini just enable shorthand tags

or look for this line
short_open_tag

then set its value to On

but beware, there are webhost that has this disable so you might end up having problems later so i suggest just dont use shorthand.

I changed it's value to On, but it still doesn't work.

I changed it's value to On, but it still doesn't work.

Well a server can have several php.ini files and only one of them are really used. So make sure the php.ini file you changed is the same one as listed when you use the following code:

<?php phpinfo(1); ?>

The above code will tell you the real location of the php.ini file and a few other settings.

Yea I changed the right file...

This is what it says

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: Off
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On

Try rebooting the apache httpd service. I've noticed on windows rebooting the computer doesn't restart the httpd service so you will need to go into your controll panel to restart the apache httpd service.
Edit: Not the windows control panel.

Ohh, now it works.

Thanks cwarn23! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.