Jump to content

Archived

This topic is now archived and is closed to further replies.

germ

"Headers already sent..."

Recommended Posts

777 and 666 aren't necessarily writable! Your host may have security software that disables access to such "world writable" files and directories. Usually you'll get a 500 error at some point. Always start with 755 (directories) or 644 (files), and if it's not writable, first try 775/664, and finally 777/666 only as a last resort. BTW, no osC files should have "5" or "7" in their permissions. There are no executable binaries or shell scripts, so only "4" or "6" should normally be used for files.

Share this post


Link to post
Share on other sites

Hi MrPhil,

many thx for your time.

My osc is little bit old, so i hope is not PHP problem (my PC store is working well, but has problem with iOSC from http://addons.oscommerce.com/info/7636 )

 

My error is Warning: Cannot modify header information - headers already sent by (output started at /home/kacik/ftp/pupil/mobile/includes/application_top.php:9 ....:

 

O/S = Linux.

/home/kacik/ftp/pupil/mobile/includes/application_top.php has 43 lines.

The PHP start tag is on line 1.

The PHP end tag is on line 43.

Contents from start of file to the PHP start tag:

 

<?php[0D][0A]

 

-------------------------

Contents from PHP end tag to end of file:

 

?>

 

-------------------------

Extended contents of the requested line [9] are:

 

<style[20]type="text/css"[20]media="screen">[0D][0A]

 

-------------------------

Raw contents of the requested line [9] are:

 

Can you explain me where i suppost to looking for errors ?

 

THX !

Share this post


Link to post
Share on other sites

It's telling you that file includes/application_top.php is sending output to the browser, on or about line 9. That file should not send any output to the browser. Has the file been hacked? Is it reporting an error? Did you make a mistake editing it? If you can't figure it out, post the first 15 lines of the file in your next post.

Share this post


Link to post
Share on other sites

Please know, its mobile/includes/aplication_top.php, (taken from http://addons.oscommerce.com/info/7636) not the main includes/aplication_top.php - this file is brain new, couldn't be hacked.

 

mobile/includes/aplication_top.php:

<?php
error_reporting(E_ALL & E_NOTICE );
ini_set('display_errors','1');

require('mobile/includes/configure.php');
require('includes/configure.php');
  require('mobile/includes/functions/general.php');
  require('includes/application_top.php');?>
<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>
<?php   tep_debug("DEBUG IS ON");
if (PHP_VERSION>='5')
  require_once('mobile/includes/functions/domxml-php4-to-php5.php');
 $curl_installed = function_exists('curl_init');

//@[member='todo'] need to findout why it's missing $SID for cURL
if(empty($SID) && strlen(tep_session_id()) > 0 && tep_session_id() == $HTTP_GET_VARS['osCsid'])
 $SID = tep_session_name() . '=' . tep_session_id();
switch ($HTTP_GET_VARS['action']) {
  case 'remove_product':  if (isset($HTTP_GET_VARS['products_id'])) {
						   $cart->remove($HTTP_GET_VARS['products_id']);
		 }
	    tep_redirect(tep_mobile_link($goto, tep_get_all_get_params($parameters, array('module'))));
						  break;					 
   }

   if (!tep_session_is_registered('languages_icon') || isset($HTTP_GET_VARS['language'])) {
 if(!isset($lng)) {
  include(DIR_WS_CLASSES . 'language.php');
  $lng = new language();
 }
 tep_session_register('languages_icon');
 $languages_icon = tep_image(DIR_WS_LANGUAGES .  $lng->language['directory'] . '/images/' . $lng->language['image'], $lng->language['name']);
   }

include(DIR_MOBILE_CLASSES . 'header_title.php');
$headerTitle = new headerTitle();

   require(DIR_MOBILE_LANGUAGES . $language . '.php');
?>

 

Please check the error: http://www.kacikpupila.pl/mobile_account.php

 

Line numer 48 from general.php is

header('Location: ' . $url);

 

Many THX

Share this post


Link to post
Share on other sites

This is written very strangely. An "application_top.php" file is normally one of the first things called on a page. You'll notice that in turn, it calls the regular application_top.php file. application_top sets up a whole bunch of data needed by the page, but by itself does not output anything. You'll see that this one is writing out

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

 

Since there is page HTML for the browser at that point, it will cause all the header data to be flushed to the browser. That's too early, because there are other bits of header information yet to be sent. This code needs to be rewritten so that <style> tag isn't sent until the page is already well into the <head> section.

 

Was this custom written, or an add-on for osC 2.2-something? It may have to be rewritten for osC 2.3.

Share this post


Link to post
Share on other sites

You are big ! I mean you gave me some idea ;))

I deleted Code:

<style type="text/css" media="screen">
@[member='import'] "<?php echo DIR_WS_HTTP_CATALOG . DIR_MOBILE_INCLUDES; ?>iphone.css";
</style>

and now everythig is going fine except for look of site. CSS dosent work so the site is a little bit destroyed ;)))

 

So question is where should i put this Code without problem....

 

Please, please, im soo close ;))))

Share this post


Link to post
Share on other sites

Well, you need to wait until the code where the page <head> section is being output. That will depend on exactly what level of osC your site is based on, and what changes you've made to the code. Do you have some sort of global flag (perhaps set in application_top) that would tell the code to use that mobile CSS only when in mobile mode?

Share this post


Link to post
Share on other sites

Hello. I have the next problems. How can I fix those pr. Tanks in advance. Razvan

 

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function session_register() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 73

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function session_is_registered() is deprecated in /home/xxxshop/public_html/shop/includes/functions/sessions.php on line 80

 

Deprecated: Function ereg() is deprecated in /home/xxxshop/public_html/shop/includes/functions/general.php on line 1040

 

Deprecated: Function ereg() is deprecated in /home/xxxshop/public_html/shop/includes/functions/general.php on line 1040

 

Deprecated: Function ereg() is deprecated in /home/xxxshop/public_html/shop/includes/functions/general.php on line 1040

 

Deprecated: Function ereg() is deprecated in /home/xxxshop/public_html/shop/includes/functions/general.php on line 1040

 

Deprecated: Function ereg() is deprecated in /home/xxxshop/public_html/shop/includes/functions/general.php on line 1040

 

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxshop/public_html/shop/includes/functions/sessions.php:80) in/home/xxxshop/public_html/shop/includes/functions/general.php on line 27

Share this post


Link to post
Share on other sites

Click me

 

Fix the deprecated errors and the headers error will disappear.


If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Share this post


Link to post
Share on other sites

×