I've been trying to install XAMPP for quite some time now, but every time, at the end of the installation, it says:
Windows cannot find "-n"
And after that, it says:
Problem running post-install step. Installation failed (php.exe) Perhaps you have to install Visual C++ 2008 package.
I have Visual C++ 2008 package and it still says this. What do I do now? I have Windows 10 64-bit for anyone wondering.
I installed it in the root of my C: drive and it worked. Strange that previously I could just install it in my program files folder and that everything works...
Had the same problem when I tried to install xampp in a folder with spaces in its name (some folder example)
It was solved after I reinstalled xampp in a folder that has no space in its name, E.g. c:/xampp
Change your registry settings.
Open Registry Editor by pressing Windows + R key combination, type in regedit and press Enter.
If prompted by UAC, click on Yes to continue.
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
In right-side pane, look for a EnableLUA and set the value to 0 and close Registry Editor.
Restart your computer.
Source: windows10update.com
Then type in XAMPP shell:
setup_xampp.bat
That error could be shown if you already had an older version of XAMPP installed to the default folder (C:\xampp) and you try to install a new version in a specific custom folder.
Just go to the Windows Control Panel, Add or Remove programs and uninstall the old installation of XAMPP.
I can confirm using Windows 10, that the "Windows cannot find -n" message is indeed based on the fact that you are installing XAMPP in a folder which is not c:\xampp.
That is rather a huge oversight for those who distribute XAMPP, they should allow relative paths.
I was trying to set XAMPP in c:\webservers\xampp\ because I'm working with multiple versions of servers for testing and development and well, there goes that idea.
Of course, in the end, I could always just do it myself, and get each bundle I need such as APACHE, mySQL, etc.. And that would mean, not relying on XAMPP.
Anyways, it's a rather stupid flaw, but it is what it is, and it's free, so, you pay for what you get! :)
An alternative to the current answers: I found that installing in a folder with a dash also didn't seem to work for me. E.g. C:\xampp-test\ would still give an error. Changing it to C:\xampptest\ solved the issue.
I ran setup_xamp.bat once (w/o admin rights) and it did some configuration for XAMPP but that did not help. When I executed setup_xamp.bat again with admin rights, it gave a message "nothing to do!".
While looking at the Apache config I realized it is trying to listen on port 80 and I already had IIS listening on that port. Which was causing the problem.
So I changed httpd.conf to use a different port 8765 (change needed at 2 places)
Also changed httpd-ssl.conf to use a different port 8766 (change needed at 3 places)
Then in XAMPP Control panel > Config > Services and Port Settings > specified same port number for Apache.
Once that was done I was able to start Apache without any error.
Related
My computer is a Windows 10 64 bit.
I tried to run my PHP code, steps:
Downloaded php.net.
Set the environment variables path as instructed. Ran the command line like this: https://imgur.com/a/Q9zs9mL
Microsoft Windows [Version 10.0.17134.345]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Mai Do>php -S localhost:4000
PHP 7.2.10 Development Server started at Mon Oct 22 21:04:32 2018
Listening on http://localhost:4000
Document root is C:\Users\Mai Do
Press Ctrl+C to quit.
Created a PHP file, first with NetBeans
Saved the file in the root directory folder named "php1" (try to be different from my root name)
Typed in browser: localhost:4000/php1/input.php
Object not found 404 page.
Tried multiple times with different php file. same thing.
Switch to Atom. Same thing.
Moved the file to htdocs folder. Same thing
Download Xampp. Turn on the Apache and MySQL. XAMP ver 3.2.2 control panel shows up. Both Button turn to Green. Still not found.
This SO page PHP not working in XAMPP says:
If you're trying to connect via your IP then your router must be
stopping it so you have to sort the settings out. I don't know your
router make/model you better off asking their support forums.
I am thinking there might be a server config problem. Like this one has a similar issue: Apache2 not working with routes PHP
which leads to this:
https://docs.bolt.cm/3.0/howto/making-sure-htaccess-works
"Editing the apache2.conf and setting 'AllowOverride All' on , finally
works." ???
I am not sure if that is the right problem either. Can someone walk me through it? Bless you.
To set up a test environment on your personal computer, follow the steps below:
Remove any installed PHP (Windows: uninstall via "Add/Remove Programs")
Install XAMPP (in your case, it's better to re-install the software suite)
XAMPP is a software suite that contains PHP + MariaDB (a fork from MySQL) + Apache Web Server + Perl. In your case, you are going to use PHP & Apache only.
Configure the DocumentRoot in Apache config file; you should put your website files in this DocumentRoot, thus I recommend you to set the path value to your development path. Read the manual if you're unsure how to do so.
Start/Restart Apache. If everything goes smooth, Apache should be up and running at port 80 (by default).
Launch your favorite browser and navigate to http://localhost
You should see your website written in PHP
If you have any further questions, please ask in the comment box below.
Note:
NetBeans is an IDE, not related to your testing environment
You can actually write your PHP scripts using any text editor
Hej, I have problem with:
Apache Service detected with wrong path
4:31:33 PM [Apache] Change XAMPP Apache and Control Panel settings or
4:31:33 PM [Apache] Uninstall/disable the other service manually first
4:31:33 PM [Apache] Found Path: "C:\Apache\bin\httpd.exe" -k runservice
4:31:33 PM [Apache] Expected Path: "c:\xampp\apache\bin\httpd.exe" -k runservice
How to fix it? In advance, thank you.
I just encountered the exact same problem a few days ago and was having a hard time finding the fix, but I finally able to fix it.
Here's my fix:
Win + R and type regedit then enter
Open this directory HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache2.4
Right-click on the "ImagePath" and choose "Modify"
Change the Value Data field with your current installed path of apache in XAMPP
In my case, the value is "D:\apps\xampp\apache\bin\httpd.exe" -k runservice
For the question poster case, change the value to "C:\xampp\apache\bin\httpd.exe" -k runservice
I know it's an old post, but some people might still need this in the future. I hope it can help :)
UPDATE 12/7/2022:
This is due to our local machine already has Apache installed aside from XAMPP's Apache OR previously has installed XAMPP but in different folder directory. So my fix above is to change the Apache's target path to XAMPP's Apache path (In the folder where you installed xampp).
Another way to fix is to uninstall your existing Apache. You can find the folder directory from the error message that you got. the Found Path: C:\Apache\blablabla which could vary in every machine
I experienced the same problem. The solution that worked for me is :
Run the XAMPP in the administrator mode. Go to the XAMPP control panel.
In the modules section, in the 'Service' column, we are provided with checkboxes.'
For the services that you are facing problems with, click on the corresponding checkbox to uninstall the service.
Also, click on the same checkbox again to re-install the service.
I hope it works!
Try
Control panel > Administrative Tools > Services, after get de services name, in my case:
Apache2.4
mysql
Run "CMD" as administrator and put this command:
C:/windows/system32> sc delete Apache2.4
C:/windows/system32> sc delete mysql
Close Xampp Panel and try again.
Greetings from Mexico.
I was also experiencing the same problem for some days. Finally, I got the solution. Follow the given steps, that worked perfectly for me:
RUN the XAMPP Control Panel As Administrator
Below the Service column, you will see checkboxes, click on the checkbox to install it (if not already installed marked as RED CROSS) and if it is already installed, then uninstall it first by clicking on the GREEN TICK. Make sure the service is STOPPED
Then START the service again. That's all. Enjoy
Still not working, close the XAMPP, RUN it again as Administrator
Still not working, restart the PC (I have just experienced it)
Although Old Question but common problem for the new developers.
Solution for my case:
Run "CMD" as administrator and put this command:
C:/windows/system32> sc delete Apache2.4
restart the Xampp
It means you have Apache installed and running service from the location C:\Apache\bin\httpd.exe
You need to stop the service and start xampp
If you planing to work with XAMPP environment more comfortable way is:
Uninstall Apache (at C:\Apache\bin\httpd.exe)
Check Apache process at
C:\Apache\bin\httpd.exe if it in memory - kill it.
Change your port in the httpd.conf file, this might solve the problem because you might have a Node.JS server or Skype or another application running at port 80.
I will assume that you have uninstalled and reinstalled XAMMP multiple times, due to the fact that Apache has started the service with the wrong path. The key is to delete the service and restart XAMMP control panel
I need to use Chrome to run a local PHP file. I believe I've done all that is required to do this (acc. to multiple web sites, inc. php.net), however, all I get is a blank web page. The things I've done to enable this capability are:
Install MS Visual C++ 2010 x64 Redictributable 10.0.40219
Enable IIS on my Windows 7 Home Premium PC by following instructions at http://php.net/manual/en/install.windows.iis7.php, including executing at the cmd line their "Examples" 2, 3, 4, 5, 6, 9, and the one enabling 64 bit operation
download php-5.4.31-nts-Win32-VC9-x86.zip, then follow instruction re: changing the php.ini file at http://php.net/manual/en/install.windows.manual.php (e.g., copy the php.ini-production into php.ini)
Put my php script into the folder C:\Users\Wade\AppData\Local\Google\Chrome\User Data\Default\User Scripts the script is simple:
<?php $row = "1.jpg";
echo $row;
?>
In Chrome, entered the url http:/localhost/<script-file-name.php>
Please help!
If you want to run PHP on IIS server then you can go with Microsoft Web Platform Installer.It automatically configures IIS server with PHP for you.
I'm not used to chrome, but i doubt this folder is made to run local php script.
Do you have some reason for choosing IIS ?
If not, and if you just want to run php file locally, you'll probably find a lot easier to use some programs such as Xampp to install & configure a little Apache web server for you.
If you choose to go this way, you need to :
disable or uninstall IIS , to prevent conflicts.
download xampp installer for windows : https://www.apachefriends.org/fr/index.html (some other alternatives exists, easyphp, etc.. )
install like any other program, the default settings are probably good enough.
delete all the files in the newly created c:\xampp\htdocs\ folder.
launch c:\xampp\xampp-control.exe (that may not be the exact name, but it's easy to spot in the folder) , and check that the Apache module is marked as started ( if you installed it as a service - which i think is the default - it will launch on windows start )
put your php files in c:\xampp\htdocs\
navigate to http:/localhost/
Hope this helps.
After making changes in php.ini by uncommenting
extension=php_openssl.dll
My Windows-8 system got shutdown due to power failure and later i use to get this error when i try to start wamp server
Later visiting some link i added the below code to wampmanager.ini file as it was empty
Now the first error got fixed and now throwing this error mentioned below:
Later i also installed visual c++ 2008 to fix this error but unsuccessful. I have many important databases which i have not taken back up also. I am trying to repair this wamp server without re-installing. Can anybody please assist me with this.
Thanks in Advance
go to the wamp/scripts folder
open console
run:
php refresh.php
this should recreate wampmanager.ini
(requires wampmanager.tpl file in wamp folder.
taken from http://sourceforge.net/p/wampserver/feature-requests/10/#750b)
This document may help you How to uninstall WAMPServer without actually uninstalling it
The idea is that you uninstall your current version without actually running the unninstall and without actually deleting any files from your existing install.
You then rename the current wamp folder and then install the same version of wamp, make sure it works, and then copy all your sites and databases to the new installed wamp. If you install exactly the version of WAMP you have currently then you can copy the whole of the .../mysqlx.y.z/data folder and all you databases and users should be there on the new install.
This gets over whatever damage was done to your existing install. You may need to edit the php.ini and httpd.conf to match your existing configuration. I suggest you do not do a straight copy of either of these files as that may just get you to where you are now.
Fixed by installing wamp again into the same directory by renaming the older wamp. I just replaced wampmanager.ini file of new to the old one. Earlier it was just a little piece of code i pasted in wampmanager.ini file. But now it is a big one which fixed this issue. Thanks a lot for you guys, your suggestions saved my time. I did not change anything with php.ini also.
Backup all YOUR databases in SQL format and store the backups somewhere safe.
Stop All Services.
Remove the Apache Service.
Remove the MySQL Service.
Exit WAMPServer.
Rename your current \wamp folder to \wamp_old (This is your backup. DONT FORGET THIS STEP)
To all intents and purpose, you have uninstalled WAMPServer now.
7. Download and Install the new WAMPServer version
(32bit is recommended, 64bit is only for geeks and 64bit PHP is not yet fully converted to 64bit)
Change NOTHING! Check it works in its out of the box state.
Clear your browser cache ( CTRL+F5 ) to avoid any funnies with cached content.
Run localhost
Run phpMyAdmin (If asked for a Username and password; username = root / password = (nothing, leave this blank)
Run \wamp\www\testmysql.php. you will need to edit the file and change the "mysql_connect('127.0.0.1', 'root', '')"
If you want to bring some/all of your old versions of Apache/PHP/MySQL into the new WAMPServer
(Remember, one of the big advantages in WAMPServer is the ability to switch between versions of Apache/PHP and MySQL)
Apache: copy \wamp_old\bin\apache\apachex.y.z folder to \wamp\bin\apache\apachex.y.z
PHP: copy \wamp_old\bin\php\phpx.y.z folder to \wamp\bin\php\phpx.y.z
MYSQL: copy \wamp_old\bin\mysql\mysqlx.y.z folder to \wamp\bin\mysql\mysqlx.y.z
To tell WAMPServer about the old version of Apache/PHP/MySQL you just copied across run a "refresh",
right click the wampmanager icon -> Refresh
Give it a few seconds to go find all the new versions.
Compare your old configs with the new configs, move over any of your local change/requirements.
Remember, config parameters change between versions of Apache/PHP/MySQL !
Make sure your old changes are still required, valid, legal. ( Check the upgrade notes provided by all 3 software providers )
If it all goes horribly wrong. Check the bottom of this Doc to see how to unwind all these changes easily if you get problems.
help you
I have had the same issue. I am working with WAMP 2.5 version. The content of "wampmanager.ini" is OK but it's possible that the php path is wrong. Check folders of section [StartupAction], in my case my php version is "php5.5.12". Surely the error message "The directory name is invalid" was for this.
In win10 you can just right click on the wampmanager.ini file in the root and select Restore Previous Version, then just choose one from a few days ago when it worked.
i have similair issue in the morning and searched SO and other forums but none of the solution worked for me.
It was
syntax error on line number 561 (due to MariaDB)
After checking all wamp installation for MariaDB, i find out that file at root: wampmanager.conf contain lines about MariaDB. I removed all of those and then restarted wamp. It worked like charm!
Rename the wamp folder, you can just add a 1 or 0 to somehing like wamp641 then
re-install wamp server
3.copy paste the mysql and project folders from Bin and WWW respectively from the renamed wamp folder to the newly created folder after installation so that you dont loose any database and project files from your previous projects.
4 start your wamp and it should work well.
I am currently using Windows XP SP3 with Apache 2.2, PHP 5.3, MySQL 5.1 and XAMPP 1.7.3 installed.
However after installing everything including XAMPP, I could not see the "XAMPP Welcome Page" at all! I only see the Apache default Page "It Works!!" on http://localhost/ . I also tried http://127.0.0.1/ but it gives back the same Apache results. My Apache and MySQL service seems to be running fine on the XAMPP console.
I have also placed a php file under C:\program files\apache\htdocs\test.php and access the page via http://localhost/test.php which works fine! I really can't guess why isn't the XAMPP installed over the Apache.
Can anyone please give some advice on the problem? Thanks.
XAMPP is a standalone AMP solution, so you don't need to install Apache or anything else with it. And if you do, both servers will probably conflict.
You need to either uninstall XAMPP, or uninstall Apache, PHP, and MySQL.
Note that XAMPP needs to be started up through its control panel, accessible from whatever start menu folder it will have created.
EDIT: Also, XAMPP has its own htdocs folder, located in C:\xampp\htdocs
Alternatively you can switch the port of the Apache server that came with your XAMPP installation via httpd.conf. and as it is described here for example:
Just remember to address the corresponding pages via http://localhost:XXXX
XXXX being the new portnummer you picked (for example 8080).
check the port from xampp control panel >config > Apache httpd.conf
then