Home > Article > Backend Development > PHP custom installation_PHP tutorial
① Custom installation (first stop the apache service in the management, then uninstall apache, and then install without restarting the computer)
apache php mysql phpmyadmin install by yourself
We recommend that you install to the same folder during installation and use management (no Chinese characters for the folder)
Test each one after installation.
1. apache
After completion http://locahost
2. Download the php core package (used to support php development, similar to JDK in java)
VC6 is the legacy Visual Studio 6compiler, which is compiled using this compiler.
VC9 is the Visual Studio 2008 compiler, which is compiled using Microsoft's VS editor.
So how do we choose which version of PHP to download?
If you are using Apache PHP under windows, please choose the VC6 version;
If you are using IIS PHP under windows, please choose the VC9 version;
What is Non Thread Safe?
Non Thread Safe means non-thread safety;
What is Thread Safe?
Thread Safe is thread safe;
The official does not recommend that you use Non Thread Safe in a production environment, so we choose the Thread Safe version of PHP to use
The installation of php core package is to unzip it soon
3. How to integrate apache and php
In other words, how to let apache handle php
①Add the following code to the httpd.conf loading module in the conf directory of apache:
LoadModule php5_module php installation path/php5apache2_2.dll(must be php5 and apache2.2 versions!!!!!!!!!)
PHPIniDir php module installation path
AddType application/x-httpd-php .php .phtml
Explanation, we only need to include the red part and change it to the actual PHP installation path
addtype refers to Only if the suffix of the requested file is .php .phtml, you need to call this tool to complete the analysis.
② Change the php.ini-development file to php.ini. Why change it? Because our php settings need to be modified in php.ini
② You can specify the corresponding function module in php.ini
;Here we need to specify the PHP extension library path
extension_dir = php module installation path/ext (line 807)
Since php is already an apache module, although php.ini is used by the php module, apache is responsible for loading it. So restart apache.
Test to see if apache and php are integrated successfully
Write a piece of code like this
phpinfo();
?>
Restart http://localhost/test.php
4. Install the database mysql (you must clean the registry when uninstalling the database, otherwise the installation will remain unresponsive)
Test whether mysql can be used
1. Write a piece of php code to test whether it is successful!
//You can’t understand it right now, that’s okay
$conn=mysql_connect(localhost,root,password);
if($conn){
echo connects to mysql database ok;
}else{
echo failed to connect to the database;
}
?>
When we do not configure php correctly, it will report
Fatal error:Call to undefined function mysql_connect() in C:myenvapachehtdocs emp.phpon line 3
Reason: The mysql function is not currently enabled, in php.ini
extension=php_mysql.dll
extension=php_mysqli.dll
2. Install a phpmyadmin (this website can actually manage mysql better) to see if it can be used
Extract the compressed package directly to the htdocs directory, and then access it directly
http://localhost/phpmyadmin/index.php is enough.
14. Now, let’s install a discuz forum on the PHP development/running environment we built.
http://jingyan.baidu.com/article/86f4a73e5bb53237d652693c.html
① Prepare a discuz forum code
② Extract it to the htdocs directory
③ Copy the upload file of discuz to the discuz folder, and then delete the upload folder
④ Modify config.inc.php
// [CH] Please modify the following variables according to the account parameters provided by the space provider. If you have any questions, please contact the server provider
$dbhost = 'localhost'; //Database server
$dbuser= 'root'; // Database user name
$dbpw = 'root'; // Database password
$dbname = 'discuz'; // Database name
$pconnect = 0; // Database persistent connection 0=closed, 1=open
//[CH] Forum security settings, adjust the following settings to enhance the security and defense performance of the forum
$adminemail ='admin@your.com'; // System administrator Email
$forumfounders= 'admin';
⑤ http://localhost/discuz
If you are prompted Sorry, please set short_open_tag in php.ini to On, otherwise you cannot continue to install the forum. Then modify