0

hallo there

i had built a bunch of webpages and they ve been working fine for months.
yestarday i installed this website to another computer after i instaled easyphp 5.4.6 (Apache 2.4.2, mysql 5.5.27 and php 5.4.6).
it seems that nothing is working as it should. after i debug my code i found out that the tag <?, that i used a lot, can not be parsed. it is not understantable by php. The php recornizes only <?php tag.

Is there a solution to deel with it all at once or i have to find every <? tag in my code and replace it? Its a lot of code....

Excuse my English...

Edited by dourvas

4
Contributors
10
Replies
39
Views
4 Years
Discussion Span
Last Post by dourvas
Featured Replies
  • 1

    There are tools like [PowerGrep](http://www.powergrep.com/) that can help you with a search and replace in a lot of files at once. It has a 30-day trial. I'm a satisfied customer, really made my life easier. Read More

  • 1

    Yes, you could enable `short_open_tags`, but I don't recommend it. If you ever need to upload to a shared host, then your code won't work (again). Read More

  • 1

    in your previous configuration, short tags were enabled. you can replace <?php to <? and then replace <? to <?php or replace '<? ' (with space after questionmark) to '<?php ' the first way seems better to me Read More

1

There are tools like PowerGrep that can help you with a search and replace in a lot of files at once. It has a 30-day trial. I'm a satisfied customer, really made my life easier.

Edited by pritaeas

0

really?
i though that it is a just a setting in my php.ini that i have never learned of. Is there another way? we are talking about 30000 lines of code. Can we adjust php to consider <? as <?php
??????????

1

Yes, you could enable short_open_tags, but I don't recommend it. If you ever need to upload to a shared host, then your code won't work (again).

Votes + Comments
this one is correct, you should enable short_open_tags in php.ini file before using php short tags.
0

as pritaeas said, you should set short_open_tags to true:

ini_set('short_open_tags', 1);
0

ok thanks
just a question about that. Why this happened? the php5 caused it?

and some more.. sorry..

i can not search and replace automatically because i use the tags <? and <?php both. if i ask to replace <? it will also replace <?php to <?phpphp. is this Rihgt?

About the second solution. I have to insert this line to every php file i use (up to 300). is this right?

Edited by dourvas

0

but I don't recommend it

I don't think pritaeas said to do it, but rather you "could" do it, but he doesn't recommend it.

You can search for just "<?" and replace it with "<?php". If you do it right with regex it should not touch the existing "<?php". This will probably work for that ^(<\?)

1

in your previous configuration, short tags were enabled.

you can replace <?php to <? and then replace <? to <?php

or replace '<? ' (with space after questionmark) to '<?php '
the first way seems better to me

Votes + Comments
logical workaround
0

thanks a lot. i tried to do so but i can not find the right regular expression to put into "find" and "replace".
Is someone has the experience and knowlege to tell me so?

0

I gave a regex that should work ^(<\?)

You could also do what dorco suggested and turn all of the "<?php" into "<?" and then afterwards turn all of the "<?" into "<?php".

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.