Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    35
    Thanks
    4
    Thanked 1 Time in 1 Post

    weird issue(for me (: )

    i have index.php with this at top:

    PHP Code:
    <?php

    require_once 'classes/Membership.php';
    $membership = New Membership();

    $membership->confirm_Member();

    ?>

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    on my localhost everything works, but when i put it on my server, i am getting fatal error on line 10:

    PHP Code:
    <?xml version="1.0" encoding="utf-8"?>
    when i remove that line everything works. maybe i need to fix that setting in php.ini on my server which is responsable for that shorthand php tags?

  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,077
    Thanks
    2
    Thanked 320 Times in 312 Posts
    Yea well, your web server has the php short open tag setting turned on, which causes the <? in the <?xml tag to be seen as a php opening tag because php never made the parser smart enough to know that <? immediately followed by something other than php or white-space was not an opening php tag.

    Either turn off the short open tag setting or you will need to echo the line with the <?xml tag (when the <? is enclosed in a string, it is not seen as a php tag.)
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #3
    New Coder
    Join Date
    Jun 2009
    Posts
    35
    Thanks
    4
    Thanked 1 Time in 1 Post
    And to turn it off i need to put:

    Code:
    php_flag short_open_tag off
    in .htaccess which is in root of web server?

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,077
    Thanks
    2
    Thanked 320 Times in 312 Posts
    If php is running as an Apache module, then yes. Did you try?
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    Jun 2009
    Posts
    35
    Thanks
    4
    Thanked 1 Time in 1 Post
    I just needed a confitmation before i test this...

    Which i did just now, and it works...

    I would like to continue this topic with another problem, i have log in page, and it works on my localhost. When i put it on web i am getting:

    PHP Code:
    Fatal error: Class 'mysqli' not found in /******/Mysql.php on line 9 
    Mysql.php looks like this:

    PHP Code:
    <?php

    require_once 'includes/constants.php';

    class 
    Mysql {
        private 
    $conn;
        
        function 
    __construct() {
            
    $this->conn = new mysqli(DB_SERVERDB_USERDB_PASSWORDDB_NAME) or 
                          die(
    'There was a problem connecting to the database.');
        }
        
        function 
    verify_Username_and_Pass($un$pwd) {
            
    $query "SELECT *
            FROM users
            WHERE username = ? AND password = ?
            LIMIT 1"
    ;
            if(
    $stmt $this->conn->prepare($query)) {
                
    $stmt->bind_param('ss'$un$pwd);
                
    $stmt->execute();
                
                if(
    $stmt->fetch()) {
                    
    $stmt->close();
                    return 
    true;
                }
            }
        }
    }
    Maybe i need to use same hack to make server use php5? What do i need to put into htaccess for that?

  • #6
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,077
    Thanks
    2
    Thanked 320 Times in 312 Posts
    Either the mysqli extension is not enabled and/or your php version is not php5 or higher.

    In either case you should check with your web host to determine what method they have provided on their servers to enable php5 and/or enable the mysqli extension under php5.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •