LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ways to start a PHP script (https://www.linuxquestions.org/questions/linux-newbie-8/ways-to-start-a-php-script-837309/)

canad1an 10-10-2010 11:06 PM

Ways to start a PHP script
 
I just recently installed Fedora Server on my computer and I am planning on hosting my website on this server instead of paying for hosting..

All of my files for my website are currently using php but for some reason when I moved them here to "test" them before launching the final switch, the PHP does not work..

I have further investigated this issue to learn that my php files were written using:

<? and ?> to start the scripts

Apparently I have to write <?php and php?> to make these scripts work now.

Is there a way I can edit a system file to allow me to use both instead of having to change all my files?

-Matt

bathory 10-11-2010 12:05 AM

Hi,

You can use:
Code:

short_open_tag = On
in php.ini

Tinkster 10-11-2010 12:21 AM

Not necessarily a good idea; you're better off changing your code
to use the "proper" tags.

http://stackoverflow.com/questions/2...eptable-to-use



Cheers,
Tink

canad1an 10-11-2010 08:28 AM

Thank you all very much! I have read the arguments on the other page and have decided to keep the short tags on.
It seemed to me that there was little ground to turn them off, especially since I would be hosting my own server.

Thank you again!!!

-Matt

Tinkster 10-11-2010 01:18 PM

Shame, considering how quick and easy the fix is...

Code:

find -iname \*.php -exec sed -i.bak -r 's/<\?([[:space:]]*.*)/<?php\1/g' {} \;
?> is a valid tag w/o short_tags, so the opening
tag is all that needs fixing.


Cheers,
Tink


All times are GMT -5. The time now is 05:10 AM.