问题描述
我一直使用wamp2.2,但是我必须安装xamp1.6.8,因为我必须使用为旧php版本创建的项目.Xamp安装可以正常运行,但是当我运行它时,我无法获得本地主机站点.香港专业教育学院得到了空白页面的沼泽图标,并沟通该网站不可用.我知道这是配置案例.有人知道如何解决这个问题吗?
I use wamp2.2 for all the time, but i had to install xamp1.6.8 cause i've got to work with project created for old php version. Xamp installation goes fine but when i run it i cant get localhost site. Ive got blank page with favicon of wamp and comunicate that site is unavaible. I know that this is configuration case. Anybody know how to fix this?
我想一次只运行其中的一个,并且我已经为wamp配置了一些虚拟主机,当xamp运行时,它们不必是可访问的,我只需要为一个项目使用xamp.
I want to run only one of them at once, and i have configured some virtualhosts for wamp they dont have to be accesible while xamp is running i need xamp only for one project.
推荐答案
在同一台计算机上运行xampp和wamp,您可以从arasjoomla网站使用此教程: http://arasjoomla.ir/joomla-tutorial/how-to-run-xampp-and-wamp-on-同一台计算机例如,我们使用wamp的默认端口和设置,并在xampp中更改设置:
for run xampp and wamp in same computer you can use this tutorial from arasjoomla website: http://arasjoomla.ir/joomla-tutorial/how-to-run-xampp-and-wamp-on-same-computerfor example we used wamp with default port and setting and set changed in xampp:
- 将xampp apache端口80从
httpd.conf
中的示例更改为8080目录C:\ xampp \ apache \ conf
- 在
my.ini
中将C:\ xampp \ mysql \ bin
的port = 3306
更改为port = 3307
在
config.inc.php
中,位于C:\ xampp \ phpMyAdmin
中,位于此代码之后:
Change xampp apache port 80 to example 8080 in
httpd.conf
fromdirectoryC:\xampp\apache\conf
In
my.ini
fromC:\xampp\mysql\bin
changeport=3306
toport=3307
In
config.inc.php
fromC:\xampp\phpMyAdmin
after this code:
$ cfg ['Servers'] [$ i] ['AllowNoPassword'] = true;
添加此代码:
$ cfg ['Servers'] [$ i] ['port'] ='3307';
现在重新启动xampp,我们使用xampp和wamp作为示例连接数据库的xampp
端口3307
中的代码:
restart xampp now we cab use xampp and wamp for example use thiscode in xampp
port 3307
for connection database:
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "my_db";
$port = '3307';
$conn = mysqli_connect($servername, $username, $password, $dbname,$port);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT id, name FROM users";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["id"]. " - Name: " . $row["name"]. "<br>";
}
} else
echo "0 results";
mysqli_close($conn);
这篇关于Wamp和Xampp在同一台机器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!