Installing PHP on Windows
- Create a new folder called PHP in C: \ PHP
- Copy all the contents of the archives of php-5.2.6-win32.zip to C: \ PHP
- On the desktop, double click "My Computer" and select Properties tab
- In the dialog box of the properties of the system must select Advanced
- Click on the button Environment Variables.
-
- In the dialog environment variables under system variables select Path
- Click on the Edit button.
- In the edition of the variables of the system must add C: \ PHP to the field of variable.
- Click the OK button in all dialogs.
configuring php
- In the folder C: \ PHP, copy the file php.ini-recommended
- Rename the copy of php.ini-recommended to php.ini
- Open php.ini in the Windows Notepad.
- In the php.ini file, find these lines:
display_errors = Off
and enable the display of errors by changing the value to "On":
display_errors = On
Note: You should not use this option in production environments, this is only for testing and development areas.
- In the php.ini file, find this line:
extension_dir = ". /"
and specify the directory where PHP extensions or modules, under the usual value of "ext":
extension_dir = "ext"
- In the php.ini file, find these lines:
; Extension = php_mysql.dll, extension = php_mysqli.dll And to enable MySQL and MySQLi extensions both making the comment the same:extension = php_mysql.dllextension = php_mysqli.dll - Now, in Windows Explorer, you can copy the following libraries. Dll:
C: \ PHP \ libmysql.dll C: \ PHP \ ext \ php_mysql.dll C: \ PHP \ ext \ php_mysqli.dll - Dll libraries are pasted into the folder C: \ WINDOWS \ system32
Note: In most parts of the installation is not necessary to copy these libraries to the system32 system folder, but in other cases if necessary. Therefore it is always desirable.
- Go to Start Menu> All Programs> Apache HTTP Server 2.2.4> Configure Apache Server> Edit the Apache configuration file httpd.conf
- Add the following lines to the configuration file, at the end thereof:
LoadModule php5_module "C: / php/php5apache2_2.dll" AddType application / x-httpd-php. PhpPHPIniDir "C: / PHP" - In httpd.conf, you should find this policy:
Dir_module> <IfModule DirectoryIndex index.html </ IfModule> That should add index.php as a directory: DirectoryIndex index.php index.html dir_module> <IfModule </ IfModule> - Save the changes and close httpd.conf
- Go to All Programs> Apache HTTP Server 2.2.4> Control Apache Server> Restart
Note: You must restart Apache each time you make changes to the php.ini file settings and / or httpd.conf.
verifying the installation of php
- Open Notepad and type the following: <? Php phpinfo ();>
- Save the file as info.php in your web server path (C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs)
- Close info.php
- Open info.php in your browser (http://localhost/info.php)
If PHP is installed correctly, you should see a table of information pertaining to the PHP installation environment.
- Open Notepad and type the following:
<? Php $ mysqli = new mysqli ('localhost', 'root', 'yourpassword', 'test') if (mysqli_connect_errno ()) {printf ("Connect failed:% s', mysqli_connect_error ()); exit ( );} printf ("Host information:% s", $ mysqli-> host_info); $ Mysqli-> close ();?>
- Save the file as mysqli.php at the root of your web server (C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs)
- Close mysqli.php
- Open your browser mysqli.php (http://localhost/mysqli.php)
If MySQL is enabled, you should see the following output:
0 comments:
Post a Comment