I am a Visual FoxPro Developer and am having to introduce some new code into the PHP programs for my new company. So, I am trying to debug PHP code, in order to find out why our fiurst page, called "login_page.pgp" does not find the MySQL user. We set up a a duplicate server, and one version is Ubuntu 10.x and the new one is Ubuntu 14.04.1. We copied down all of the files (MySQL, PHP, etc.) from the live server to this TEST server.
There is a difference in the file structure. The new server for Apache 2 (Ubuntu 14.04.1) wants the main file that starts up the program to be in /var/www/html. In the Apache 1 (Ubunutu 10.x) server it was set up as /var/www where the first php file would launch from.
I probably am not providing enough info here.
The login_page.php is the first PHP file to show up. It does show up. We are testing it by calling it as http://192.168.0.154/login_page.php. This is a local server on our network. The windows Firefox Browser is able to find and access the login_page.php. However, the user is not found. We know that the user name is correct and also the password, yet the login goes to the else condition where a statement is echoed to the browser page stating that the user is not found.
I have looked at the MySQL Database and table. The table is called "logins". This table has the exact same username(s) and password(s) that I have been using to test with, yet the message which comes back is that I have the wrong username or password.
I'd appreciate any suggestions.
How to Debug PHP Code
Moderator: General Moderators
-
cecilchampenois
- Forum Commoner
- Posts: 47
- Joined: Thu Nov 06, 2014 10:29 am
- Location: Gilbert, Arizona
- Contact:
How to Debug PHP Code
Cecil Champenois
Re: How to Debug PHP Code
That shouldn't matter. What's important is where Apache's DocumentRoot is set to. If you're able to navigate to the file, this isn't the issue.cecilchampenois wrote:There is a difference in the file structure. The new server for Apache 2 (Ubuntu 14.04.1) wants the main file that starts up the program to be in /var/www/html. In the Apache 1 (Ubunutu 10.x) server it was set up as /var/www where the first php file would launch from.
Seeing that code may shed some light on what's going on.cecilchampenois wrote:However, the user is not found. We know that the user name is correct and also the password, yet the login goes to the else condition where a statement is echoed to the browser page stating that the user is not found.
Is this a remote DB server, or are you using localhost? If the latter, did you also migrate the DB?cecilchampenois wrote:I have looked at the MySQL Database and table. The table is called "logins". This table has the exact same username(s) and password(s) that I have been using to test with, yet the message which comes back is that I have the wrong username or password.
As for "How to Debug PHP Code" in the title, using var_dump and exit statements is a quick and dirty way, or you can set up XDebug, a remote debugger, and use breakpoints to inspect the code as it executes.