A blank page appears when connecting to mysql using php. after phpmyadmin is configured, it cannot be extended to mysqli.

Source: Internet
Author: User
Tags parse error
A blank page is displayed when php connects to mysql. after phpmyadmin is configured, it cannot be extended to the mysqli configuration environment as follows.
Apache_2.2.6
Mysql servers 5.5
Php-php-5.2.3-win32
PhpMyAdmin-3.4.3.2-all-languages
Windows 32-bit
Beginner, new to php, learned to connect to mysql. When something went wrong, I searched for all the methods on the Internet, but it was a bit frustrating and the software was not properly configured. how can I proceed.

1. Use a statement to test the SQL connection. The result shows a blank page. at first, a webpage error is displayed. After mysql is started, only a blank page is displayed.
If ($ dbc = mysql_connect ('localhost', 'username', 'password '))
Echo ($ dbc)

Echo (Successfully connected to mysql !)


Mysql_close ();
} Else {

Echo (failed !)


2. when phpMyAdmin installed the configuration, the web page could not be opened at first. later, it was found that it should be stored in the php directory I wrote, but it showed that the mysqli extension was missing.


These two problems cannot be solved. I don't know how to continue learning php. Very annoying. Please advise.
First of all, for the first step, in the php configuration, all dll file copies, as well as the removal of colons in php. ini, and so on, I can ensure that it is correct and I have checked it several times.

In the second layout, I was right about the username, password, and other changes in config. ini. php.
This problem still persists. Please give me some advice.

What do you encounter when you were new to php? Installation of software fails. it is too frustrating for a girl who vowed to learn php!


Reply to discussion (solution)

Are you running phpinfo mysqli?

Open php. ini settings
Error_reporting = E_ALL &~ E_NOTICE
Display_errors = On
The error message is displayed.

Girl... whatever.

If you want to learn programming, you don't have to worry about yourself.

Open the error like upstairs, and then output
Echo phpinfo ();

See what the situation is.

$ 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 and dbpass is password? Or?

Are you running phpinfo mysqli?

Oh, I don't have any information about mysql and mysqli at runtime. However, mysql can be started by running commands. after startup, phpinfo does not contain mysql information.

Girl... whatever.

If you want to learn programming, you don't have to worry about yourself.

Open the error like upstairs, and then output
Echo phpinfo ();

See what the situation is.


Well, I am right. I can't change that sentence.
I am so ashamed that I still cannot solve the problem by searching for various methods on the Internet. Thank you for your criticism.

Open php. ini settings
Error_reporting = E_ALL &~ E_NOTICE
Display_errors = On
The error message is displayed.

I have set these two items.

Reference the reply from moocky on the second floor:
Open php. ini settings
Error_reporting = E_ALL & amp ;~ E_NOTICE
Display_errors = On
The error message is displayed.


I have set these two items.
As I said, make the error

Reference the reply from luoyinqq on the eighth floor:
Reference the reply from moocky on the second floor:
Open php. ini settings
Error_reporting = E_ALL & amp ;~ E_NOTICE
Display_errors = On
The error message is displayed.


I have set these two items.

As I said, make the error

As you do. No error. The page is still blank.
We also found that wamesever was downloaded to save trouble and the above phpMyAdmin could not be used to expand mysqli.

After the modification, restart webserver. phpinfo to check whether the two settings are the same as those you have changed. if they are the same, the modification is successful, and the error should be displayed.

Reference the reply from piaolankeke on the first floor:
Are you running phpinfo mysqli?


Oh, I don't have any information about mysql and mysqli at runtime. However, mysql can be started by running commands. after startup, phpinfo does not contain mysql information.
Phpinfo does not contain mysql and mysqli modules, which proves that you have not configured mysql in php. The environment is not properly configured. how can I connect to the database?

What are you trying to extend mysql, mysqli. enable mysql and mysqli in ini. If yes, your user name or password is incorrect.

Reference the reply from piaolankeke on the first floor:
Are you running phpinfo mysqli?


Oh, I don't have any information about mysql and mysqli at runtime. However, mysql can be started by running commands. after startup, phpinfo does not contain mysql information.

If there is no information, there is no link. it doesn't matter if mysql can be started in the command line. it just means that you have the database environment, but this bridge hasn't been set up yet, as mentioned above, check whether your two dll files exist normally in your ext folder. in addition, php. the INI file is correctly set. followed by php in apache. whether the INI file path is correctly set to the current php directory.

Reference phpnewnew on the third floor:
Girl... whatever.

If you want to learn programming, you don't have to worry about yourself.

Open the error like upstairs, and then output
Echo phpinfo ();

See what the situation is.



Well, I am right. I can't change that sentence.
I am so ashamed that I still cannot solve the problem by searching for various methods on the Internet. Thank you for your criticism.

Hey ~ I 've had several days of experience on a problem, and even forgot how many times I 've done so. it doesn't matter if I finally solve the problem happily. The key is, I 've come over. Programming is a must. no matter how complicated the problem is, it will always be solved if someone helps. There are a lot of enthusiastic people asking questions and asking questions modestly. Click here...
In the end, we won't be able to help you with the strange old conference.

Or not. Alas

1. php and apache are not stored in the same directory, but in the same directory according to the configuration instructions.
An error was found. regist global = On was not modified. I was wondering if it would be the problem.

2. display_errors = On is the method emphasized On the upstairs, but it is determined that it has been changed.
Error_reporting = E_ALL &~ E_NOTICE. However, when phpinfo () is displayed
Display_errors Off. This is strange.

3. for mysql configuration, libmysql. dll has ext, and php. ini also has a colon removed, right? mysql and mysqli have all been removed.

Then, there is still no SQL information in phpinfo. Of course, there is still a blank page when connecting. Also, when I do not connect to SQL, I train some small programs. if there is an error, the page will display a prompt such as the number of errors.

Ah! Superior. I am dizzy ~~~~~~

2. display_errors = On is the method emphasized On the upstairs, but it is determined that it has been changed.
Error_reporting = E_ALL &~ E_NOTICE. However, when phpinfo () is displayed
Display_errors Off. This is strange.

Is your apache PHPIniDir "x: \ PHP \" correct path?
If you have installed an earlier version of PHP, I suggest you uninstall all the old versions and reinstall PHP. then, check whether the path is correct.
Or do I have to restart apache after modification?

... Is your name and password incorrect?

If ($ dbc = mysql_connect ('localhost', 'username', 'password '))
Password and account in the connection statement

Run the phpinfo. php file. check whether the extension mysqli is opened. if not, open the extension mysqli in the php. ini file. Then restart apache.

2. display_errors = On is the method emphasized On the upstairs, but it is determined that it has been changed.
Error_reporting = E_ALL &~ E_NOTI ......
Take a closer look. there are at least two display_errors in php. ini, one of which is commented out (there is ";" in front). you should change the one that is not commented out.

Run the phpinfo. php file to check whether mysql has been loaded. if not, run the command again to let apache load mysql. pay attention to the path when you configure the environment, and then connect to the database once.

Or not. Alas

1. php and apache are not stored in the same directory, but in the same directory according to the configuration instructions.
An error was found. regist global = On was not modified. I was wondering if it would be the problem.

2. display_errors = On is the method emphasized On the upstairs, but it is determined that it has been changed.
Error_reporting = E_ALL &~ E_NOTICE ......
Obviously, the configuration file you load is not the one you want to load. you need to modify the php configuration file specified by PHPIniDir in apache.

Maybe the configuration is correct. check your PHP code. the code I see is incorrect.

Let's take a picture first. Thank you for your reply. I first broke into csdn and posted a post. I was still wondering if I had any questions before. I was so sad to say that I had learned programming.

Partially solved.
1. I uninstalled all the installed files. it is true that php has been installed in several versions before, some open, there are build files, and some are dev. Then, install and estimate before, after, and after, that the configuration is broken. I have uninstalled all of them, and I have retained one that can be used, re-installed, and configured. Pringinfo (), OK! The mysql message that I have never seen is swollen on the page.

2. myql can be started, and the environment is configured. the link is displayed. Use the preceding statement to test the link. the code is as follows:
1 2
3 $ link = mysql_connect ('localhost', 'root', '000000') or die (mysql_error ());
4 echo (successfully connected to myqul !);
5?>
6

Row 3 has no content, but an error message is displayed.
Parse error: syntax error, unexpected T_STRING in F: \ phpwork \ testconnect. php on line 6

Hard to understand .. What's the problem ???

Echo ("successfully connected to myqul! ");

Echo '....';

It must be enclosed in quotation marks (because it is a string and it is not needed if it is a number)

Building a language learning platform is just the beginning! In case of problems, you must first consider and try to solve the problem.
Ask another question. Just like not running phpinfo ();
Or it takes a lot of effort to answer a question without reading the content. Attention should be paid to new users!
You need to have a system to understand and then ask questions. Don't ask questions if you have any questions.

Finally. The question above cannot be enclosed in quotation marks.
The following code is used. $ Dbhost = 'localhost ';
$ Dbuser = 'root'; // your mysql User name
$ Dbpass = '000000'; // your mysql password
$ Dbname = 'dbname'; // your mysql database name
$ Connect = mysql_connect ($ dbhost, $ dbuser, $ dbpass );
If ($ connect ){
Echo "the connection is successful. Give it a score! :)";
} Else {
Echo "connection failed, no money! ";
}
?>

Then, phpMyAdmin installation will be okay. Thank you for your reply. Close the post. Split.

Change short_open_tag = Off to short_open_tag = On.

There is a value of short_open_tag in the php configuration file (php. ini). after enabling it, you can use the PHP segment tag :( ).

At the same time, you can use this function only when this function is enabled.
However, this short label is not recommended. Is the standard method. This feature is saved only because the short tag is used for a long time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.