0

can anybody explain why uploaded php files treated by a server as a text file ?

The symptom is when i try to access a php file, the server send me the content of the file.

i have edited and put part of content as asked. This is output i see in the browser

*** WHAT : Removinng Meta Box in Post using $pageshow thing WHY :*****************************************/function bk_cdp_meta_box($pageshow) { switch ($pageshow) { case 'postnew.php' : add_action('dbx_post_advanced', 'bk_cdp_meta_box_reindex'); break; case 'pagenew.php' : add_action('page_advanced', 'bk_cdp_meta_box_reindex'); break; default : } if ($pageshow != "") {// remove_meta_box('postcustom', 'post', 'normal');// remove_meta_box('postexcerpt', 'post', 'normal');// remove_meta_box('trackbacks', 'post', 'normal'); }}/**************************************** WHAT : Reindex List all of Post panel Metaboxes before get remove or add a new meta_box WHY : FIXME : TODO : RETURN : ARGs :***

i download what i have upload and every one of them has <?php as i code it before, so the source of problem exist somewhere else.

9
  • Does the server support php ? If yes, is Apache configured to handle php file ? Commented Apr 26, 2010 at 20:23
  • @Michael B and @bears, yes, the server support PHP. More over, it can execute previous uploaded file php. But not the new one. Commented Apr 26, 2010 at 20:26
  • post the code contained in the uploaded php file. Commented Apr 26, 2010 at 20:27
  • 1
    It's possible you don't have the php open tag (<?php) in your files. Any text outside that tag is echoed directly to the browser. Some servers also have the short open tag <? disabled. You may have difficulties if you use it. Commented Apr 26, 2010 at 20:33
  • 1
    @justjoe Uploading in text mode (which has noting to do with passive mode) could cause DOS CRLF line endings to be replaced by Unix LF line endings. This would result in a small difference in file size. It shouldn't alter <br> tags though. Commented Apr 26, 2010 at 21:28

3 Answers 3

1

This might happen if your new uploaded files doesn't get executable attribute and the server is configured to prevent execution of such files. I've never seen such a thing though.

Sign up to request clarification or add additional context in comments.

Comments

1

If your code sample is from the start of your file the problem is you dont have any opening PHP tags e.g. <?php

Comments

1

you are missing the php open tags and the comment tags are wrong. Try this:

    <?php
    function bk_cdp_meta_box($pageshow) { 
           switch ($pageshow) { 
              case 'postnew.php' : 
              add_action('dbx_post_advanced', 'bk_cdp_meta_box_reindex'); 
              break; 

              case 'pagenew.php' : 
              add_action('page_advanced', 'bk_cdp_meta_box_reindex'); 
              break; 

              default : 
           } 
       if ($pageshow != "") {
      // remove_meta_box('postcustom', 'post', 'normal');
      // remove_meta_box('postexcerpt', 'post', 'normal');
      // remove_meta_box('trackbacks', 'post', 'normal'); 
     }
}

?>

1 Comment

@pixeline, the problem in not on that part.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.