Ok guys I'm getting trouble with my php echo command.
All the codes after the first echo command, displaying in browser.
I mean i have problem with my php echo. I tried in several scripts. I'm using wampserver 2.0.
I've given the example of my error. Please solve it ASAP.

<?
function check_perms($path,$perm) 
{ 
    clearstatcache(); 
    $configmod = substr(sprintf('%o', fileperms

($path)), -4);  
    $trcss = (($configmod != $perm) ? "background-

color:#fd7a7a;" : "background-color:#91f587;"); 
    echo "<tr style=".$trcss.">";  
    echo "<td style=\"border:0px;\">". $path ."</td>";  
    echo "<td style=\"border:0px;\">$perm</td>";  
    echo "<td style=\"border:0px;\">

$configmod</td>";  
    echo "</tr>";   
}  
?>




<table width=\"100%\"  border=\"0\" cellspacing=

\"0\" cellpadding=\"3\" style=\"text-align:center;\"> 
         <tr> 
        <th style="border:0px;"><b>File 

Name</b></th> 
        <th style="border:0px;"><b>Needed 

Chmod</b></th> 
        <th style="border:0px;"><b>Current 

Chmod</b></th> 
    </tr> 
    <?php  
            check_perms("cache","0777"); 
        check_perms("include/keys","0777"); 
        check_perms("backup","0777"); 
        check_perms("uploads","0777"); 
        check_perms("include/template","0777"); 
        check_perms("include/user","0777"); 
        check_perms("img","0777"); 
        check_perms("img/avatars","0777"); 
    ?> 
</table>

This is the code showing in browser.

"; echo "". $path .""; echo "$perm"; echo "$configmod"; echo ""; } ?>

I'm using wampserver 2.0
PHP version: 5.2.6
Mysql: 5.0.51b
Apache: 2.2.8

Recommended Answers

All 5 Replies

First thing: your statement Please solve it ASAP is not an appropriate way to state a request for help. No one here is under any obligation to help you, immediately or otherwise. If your first language isn't english, then it may just be an inappropriate use of the language so in that case take it as a free tip.

I don't think that there is anything wrong with your code. You could get this result however; if your module isn't defined as a php module (ie it must be called xxxx.php not xxxx.txt or xxxx.htm). When you execute it in your browser, you must have the module in your server's "document" library (e.g. the www directory or htdocs or whatever wamp server uses) and you must execute it from the "localhost" domain (e.g. http://localhost/yourdir/yourmodule.php).

If you are doing all those things then it should interpret the php module and act on the echo statement.

Well, Thanks Mr.chrishea. You are right. My first language is not english. Thanks for the tip. I'll improve my english.

And yes my files are already in php format.
I've changed "<?" into "<?php" and now its working. Can you give me a solution what is the problem. Because i have another project which contains only "<?" tag. The project running perfectly in my remote server. But its not working in my localhost wampserver. So can you give me a solution?

Well, Thanks Mr.chrishea. You are right. My first language is not english. Thanks for the tip. I'll improve my english.

And yes my files are already in php format.
I've changed "<?" into "<?php" and now its working. Can you give me a solution what is the problem. Because i have another project which contains only "<?" tag. The project running perfectly in my remote server. But its not working in my localhost wampserver. So can you give me a solution?

You are better off not using short tags (<?) but if you need to have them working then you will need to edit your php.ini file (in your Wampserver environment). Find the line that says:
short_open_tag=off and change it to
short_open_tag=on

then save php.ini

Wow, You are great chrishea. I've been trying to solve this error from the past five days. At last i found the solution. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.