PHP Code output to the browser (SOLVED)

Once you've installed phpList Version 2... ask questions here!
Forum rules
Please help the volunteers to help you by supplying the version of phpList you are using, browser & version and if possible, a link to your phpList installation. This is for Version 2 of phpList (the orange one).

PHP Code output to the browser (SOLVED)

Postby funke » 8:20am, Tue 22 May, 2007

Hi guys,

Not sure exaclty where this post should go...

I downloaded and installed PHPList on my local machine (running Apache2 and PHP5). I ran the config, and a heap of PHP code was being output to the browser.

I figured out the issue and I fixed it - what was happening was the code that was outputting was using short tags (<?).

To use code like this, you need to enable the short_open_tag option in the php.ini file. Please note that this is set to off by default, so you need to do one of the following:

1. Developers of PHPList need to stop using short tags, and use <php> tags for all code blocks.
2. Change your PHP congfiguration (depending on the server, you may not have permission to do this) -
Code: Select all
short_open_tag = Off
should be changed to:
Code: Select all
short_open_tag = On
Don't forget to restart Apache!

3. Change all instances within the code - you can easily find all occurances of <? and <?= using the following two regular expressions: ^<\?$ and <\?=. Fire up your favourite editor and use the above regular expressions to replace the tags with <?php and <?php echo <statement>; ?> respectively. Don't forget the ; character just before the ?> end tag!

A note to *all* developers: it would be great if you didn't use short open tags on any PHP code - it may save a few characters of space here and there, but it's really not worth it - less technical users may not be able to fix this themselves. I think PHPList is am awesome application, and it definitely has heaps of potential... Keep up the great work!
funke
phpList newbie
 
Posts: 2
Joined: 7:58am, Tue 22 May, 2007

Postby H2B2 » 12:41am, Fri 25 May, 2007

Related to this FAQ:
# I just installed phplist. When loading the admin page I get some PHP code instead of a clean page. How do I fix this?
* This issue is probably related to the use of 'short tags'. You should be able to fix this by adding the following line in the lists/.htaccess file: php_flag short_open_tag on
* Alternatively, you could convert short tags to long tags by using the short2long.sh script included in the scripts directory of the phplist archive.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby funke » 2:41am, Fri 25 May, 2007

* Alternatively, you could convert short tags to long tags by using the short2long.sh script included in the scripts directory of the phplist archive.


What if you're using a Windows machine? A shell script would obviously not run...

My bad for not reading that part carefully enough, but isn't it easier just to code it the right way in the beginning? For portability, it's much nicer just to have the long tags in the code already. If this shell script works well, why not run it on the current version so that when people download it, it's ready to go? You can then remove that whole section on short tags!

I'm not trying to be a pain, I just want to offer some constructive criticism. This project has got some real potential, and I think that its functionality and feature set is A-1! Keep up the awesome work everyone!!

Cheers,

Michael
funke
phpList newbie
 
Posts: 2
Joined: 7:58am, Tue 22 May, 2007

Postby H2B2 » 3:00am, Fri 25 May, 2007

Your comments are quite valid. And I suppose short tags may become history at some point in the future.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006


Return to Question & Problems - after installing

Who is online

Users browsing this forum: No registered users and 8 guests