The configuration environment is as follows.
apache_2.2.6
MySQL Server 5.5
Php-php-5.2.3-win32
Phpmyadmin-3.4.3.2-all-languages
Windows 32-bit
Novice, beginner PHP, learn to connect to MySQL. There is a problem, search all the methods on the Internet have no solution, a bit frustrated, the software is not configured well, then how to go down ah.
1. Test the connection SQL with a statement. The result is a blank page, initially displaying a page error, and when MySQL starts, it displays only blank pages.
if ($dbc =mysql_connect (' localhost ', ' username ', ' password '))
Echo ($DBC)
Echo (successfully connected to mysql!)
Mysql_close ();
}else{
Echo (failed!)
2.phpMyAdmin installation configuration, initially cannot open the page, and later found that it should be placed in the storage I wrote the PHP directory, but also shows: missing mysqli extension.
These two can not solve, I do not know how to continue to learn PHP. Very annoying. Ask for expert guidance.
First of all, for the first step, the PHP configuration, all DLL files are copied, and the colon in the php.ini is removed and so on, I can ensure that it is correct, have been checked several times.
In the second cloth, for the user name in the config.ini.php, password and so on changes, I also have been duly correct.
But that's still the problem. Ask the expert pointing ah, I really do not have a rut.
In other words, when you were a novice in PHP, you also encountered so many problems? Install a software is not successful, too frustrated an oath to learn PHP girl's enthusiasm!
Reply to discussion (solution)
Do you run Phpinfo with mysqli?
Open php.ini Settings
error_reporting = E_all & ~e_notice
Display_errors = On
You'll see the error message.
Girls...... Whatever it is.
If you want to learn programming, do not control yourself.
Just like upstairs. Open the error and then output
Echo Phpinfo ();
See what happens.
$link = mysql_connect (' localhost ', ' username ', ' password ') or Die (' Faild connected to mysql! ');
Echo (successfully connected to mysql!);
$link = mysql_connect (' localhost ', ' username ', ' password ') or Die (Mysql_error ());
In addition, your dbuser is username, Dbpass is password? Still is?
Do you run Phpinfo with mysqli?
Oh, I run the time without any information on MySQL and mysqli now. However, in the run with the command can start MySQL, after the boot phpinfo also do not have MySQL information.
Girls...... Whatever it is.
If you want to learn programming, do not control yourself.
Just like upstairs. Open the error and then output
Echo Phpinfo ();
See what happens.
Well, the criticism of the right, that sentence to change the findings can not be changed.
Very ashamed, online to gather a variety of methods or can not solve, so a bit manic. Thank you for your criticism.
Open php.ini Settings
error_reporting = E_all & ~e_notice
Display_errors = On
You'll see the error message.
I've set both of these.
Reference 2 Floor Moocky's reply:
Open php.ini Settings
error_reporting = E_all & ~e_notice
Display_errors = On
You'll see the error message.
I've set both of these.
Do as I say, make a mistake.
Reference 8 Floor Luoyinqq's reply:
Reference 2 Floor Moocky's reply:
Open php.ini Settings
error_reporting = E_all & ~e_notice
Display_errors = On
You'll see the error message.
I've set both of these.
Do as I say, make a mistake.
Just as you did the setup. There is no mistake. The page is still blank.
and found that downloaded Wamesever want to save trouble, found above the phpMyAdmin is also unable to expand mysqli
After the change is over, restart the webserver,phpinfo to see if these two settings are the same as you, if the change is successful, then the error should be displayed.
Reference 1 Floor Piaolankeke's reply:
Do you run Phpinfo with mysqli?
Oh, I run the time without any information on MySQL and mysqli now. However, in the run with the command can start MySQL, after the boot phpinfo also do not have MySQL information.
There are no MySQL and mysqli modules in the phpinfo to prove that you have not configured MySQL in PHP. Environment is not configured well, how to connect the database?
Do you want to expand MySQL mysqli ah, you simply php.ini the MySQL and mysqli in the open it, if all open or so that is your user name or password there is a problem
Reference 1 Floor Piaolankeke's reply:
Do you run Phpinfo with mysqli?
Oh, I run the time without any information on MySQL and mysqli now. However, in the run with the command can start MySQL, after the boot phpinfo also do not have MySQL information.
No information is not on the link, the command line can start MySQL does not matter, it just said you have a database environment, but this bridge has not been good, it said Check that your two DLL files are not normally present in your Ext folder. Additionally, the php.ini file is not set correctly. The second end is that Apache's php.ini file path is set correctly to the current PHP directory.
Reference 3 Floor Phpnewnew's reply:
Girls...... Whatever it is.
If you want to learn programming, do not control yourself.
Just like upstairs. Open the error and then output
Echo Phpinfo ();
See what happens.
Well, the criticism of the right, that sentence to change the findings can not be changed.
Very ashamed, online to gather a variety of methods or can not solve, so a bit manic. Thank you for your criticism.
I have several days on a problem wandering experience, even I have forgotten how many times so, and the final solution is not happy is not important, the key is, I came. To program this is a must-have, no matter how complex the problem, as long as someone help will always solve. Here are a lot of enthusiastic people ask questions, open-minded. A click ...
Not at last, that strange sorghum old assembly to help you.
It's still not working. Alas
1. PHP and Apache are not placed in the same directory, but also follow a configuration instructions placed in the same directory again.
Found a mistake, regist Global=on did not change, changed this. Thought it would be the problem.
2. The method that is emphasized above, display_errors = On is determined to be changed.
error_reporting = E_all & ~e_notice This also has. But when Phpinfo (), the show
Display_errors off off. This is strange.
3. mysql configuration, libmysql.dll have ext, php.ini also have the front colon removed, yes, MySQL and mysqli are removed.
Then, there is no SQL information in Phpinfo (). Of course, the connection time is still blank page. Well, I do not connect to SQL when training some small programs, if there is an error, the page will show errors in the first few lines of the prompt.
Ah! Expert. I'm really dizzy, ~~~~~~.
2. The method that is emphasized above, display_errors = On is determined to be changed.
error_reporting = E_all & ~e_notice This also has. But when Phpinfo (), the show
Display_errors off off. This is strange.
Your Apache Phpinidir "x:\PHP\" is not the correct path?
If you have previously installed an older version of PHP, I recommend that you uninstall all the old ones completely and then reinstall PHP. And check that the path is correct
Or is it necessary to restart Apache after the modification has no action?
... Did you fill in the wrong name and password?
if ($dbc =mysql_connect (' localhost ', ' username ', ' password '))
The ... in this connection statement. Passwords and Accounts
You run the phpinfo.php file, see this mysqli this extension open no, if not go to php.ini file to open mysqli this extension. Then restart Apache.
2. The method that is emphasized above, display_errors = On is determined to be changed.
error_reporting = E_all & ~e_noti ...
Look carefully, there are at least two display_errors in the php.ini, one of which is commented out (preceded by ";" ), you should change the piece that is not commented out.
Run this phpinfo.php file first, see if there is no load MySQL, if not, re-operate once, let Apache load MySQL, note you configure the environment when the path, and then in the connection once the database to see
It's still not working. Alas
1. PHP and Apache are not placed in the same directory, but also follow a configuration instructions placed in the same directory again.
Found a mistake, regist Global=on did not change, changed this. Thought it would be the problem.
2. The method that is emphasized above, display_errors = On is determined to be changed.
error_reporting = E_all & ~e_notice This ...
Obviously the configuration file you loaded is not the one you want to load, you need to modify the specified PHP configuration file specified in Apache to Phpinidir
Maybe the configuration is correct, check your PHP code, I see the code is not
Let's leave a shadow. Thank you for your reply. I first break into csdn and post, before there are problems still know on posting, really ignorant, are embarrassed to say that they are learning programming.
Part of the solution.
1. I uninstalled all installed files, it is true that PHP was installed before several versions, some open, there is a build file add, and some are dev and so on. Then install it backwards and forwards. The configuration is broken. I've uninstalled all of them, and then kept the one you can use, reinstall, configure. Pringinfo (), ok! I have never seen the MySQL message actually appearing on the page swollen, really happy dead.
2.MYQL can be started, the environment is also configured, the link. To test the link with the above brother's statement, the code is as follows
1 2
3 $link =mysql_connect (' localhost ', ' root ', ' 123456 ') or Die (Mysql_error ());
4 Echo (successfully connected to myqul!);
5?>
6
There is no content in line 6th, but there is an error message.
Parse error:syntax error, unexpected t_string in F:\phpwork\testconnect.php on line 6
Inexplicable in the. What's going on here???
Echo ("Successfully connected to myqul!");
echo ' ... ';
Enclose it in quotation marks (because it is a string, if it is a number)
Learning to build a language platform is just the beginning! If you have a problem, think about it before you try to handle it.
Ask again. Just like not running phpinfo ();
or run without looking at the content so the question is much more laborious to answer. Novice to pay more attention!
I want to have a systematic understanding of the question again. Don't ask questions whenever you have a problem.
It's finally done. The question above is not quoted.
The following code has been used. $dbhost = ' localhost ';
$dbuser = ' root '; Your MySQL user name
$dbpass = ' 123456 '; Your MySQL password
$dbname = ' dbname '; Your MySQL library name
$connect = mysql_connect ($dbhost, $dbuser, $dbpass);
if ($connect) {
echo "Connection success, give points!" :)";
} else {
echo "Connection failed, no money!" ";
}
?>
Then, the installation of phpMyAdmin is no problem. Thank you for your reply upstairs. Knot stickers. Scattered points.
Change Short_open_tag = off to Short_open_tag = On
In the PHP configuration file (php.ini) There is a Short_open_tag value, open later can use the PHP segment tag: ( ).
At the same time, you can use this only by opening it
But this short label is not recommended, the use is the standard method. Just because this short label is used for a long time, this feature is preserved.