Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

another php question..

  • 25-10-2003 2:11pm
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    sorry, guys , but I've got another php question...

    I think the problem is the php isn't working. :(
    eg
    I created a php file with the following

    <?php
    echo `php is working correctly`;
    ?>

    and placed it in the public_html directory under the filename phptest.php
    When I pointed to it with the browser I got the following


    echo `php is working correctly`;?>

    does anyone have any idea as to what the problem is??

    AFAIK, the php module is loaded automatically with apache??

    Please help :)

    Thanks,
    king


Comments

  • Closed Accounts Posts: 6,601 ✭✭✭Kali


    you're using the wrong inverted comma.. use ' or preferably " not `(which typically invokes a shell command).. anyway try:

    php_info();

    on its own to see if php is installed correctly.


  • Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭king_of_inismac


    I knew somebody was going to say that.. :)

    I did use the right apostrophy when writing the code, just couldn't find it when I was writing the post earlier.....

    Added the phpinfo() line to the code, but its not displaying anything..

    All the html is showing up fine,

    Please advise,
    Thanks


  • Technology & Internet Moderators Posts: 28,840 Mod ✭✭✭✭oscarBravo


    Originally posted by Kali
    use ' or preferably "
    Why preferably " ? Each has its place. The double quote allows special characters and variable expansion, but it's ipso facto slower to parse. For best performance, you should use the single quote unless you need the extra capabilities of the double quote form.

    Inismac, can you post your httpd.conf so's we can see what might be wrong? For example, mine has
    LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
    AddType application/x-httpd-php .php
    
    Do you have these entries? Have you restarted apache? Have you checked apache's logs?

    BTW, when you're posting PHP code here you can use vBulletin's [php] tags: [php]<?php
    echo 'php is working correctly';
    ?>[/php] Purty or wot? :)


  • Registered Users, Registered Users 2 Posts: 912 ✭✭✭chakotha


    Locate the httpd.conf file (located /httpd/conf/httpd.conf or maybe /apache/conf/httpd.conf) and add the line

    AddType application/x-httpd-php .php .php3 .inc

    then reboot apache

    This will make sure all files .php3 .php and .inc are parsed by PHP before being sent to the browser.

    Hope that helps

    Edit: Oops oscarBravo suggested that. I'd add the .inc to the line too so on a live site there is no chance of .inc files arriving to the browser unparsed revealing raw code or passwords


  • Technology & Internet Moderators Posts: 28,840 Mod ✭✭✭✭oscarBravo


    Originally posted by chakotha
    I'd add the .inc to the line too so on a live site there is no chance of .inc files arriving to the browser unparsed revealing raw code or passwords
    Good call - mind you, to be really safe, I call my included files *.inc.php, and put them somewhere outside the webroot. Can't be too careful...


  • Advertisement
  • Closed Accounts Posts: 49 surfboy


    php.net is an excellent resource for finding answers to this type of stuff, and getting answers to code problems/error.


Advertisement