I have downloaded some files which have .php extension.
Then I installed WAMMP server on my, but I am not able to view those files. I have also turned off the IIS from the add/remove windows program. Still, I am not able to view the pages.
I'm presuming that by WAMP, you are using Apache as your server? You need to find your www folder in C:\WAMP\www and place files in there.
Here is the wamp server I use.
http://www.wampserver.com/en/download.php
I have also used this one in the past.
http://www.apachefriends.org/en/xampp.html
Click on the wamp server icon on your taskbar, go to Apache and you will find Test Port 80 in there. That will show whether port 80 is available or not. If not, go to httpd.conf file which is in the Apache menu of wamp server, find line Listen 80. Change 80 to 88. Restart All Services in wamp and that should work. Let me know if that helped.
How are you trying to view the pages? Why exactly are you "not able" to do it? Are you aware that PHP files are basically programs that run on a server, and you view their output using a web browser? Assuming that you have actual PHP files (rather than their output) and all the resources that they need, you will have to put them into the source folder that WAMP is configured to display, and then you will be able to view them by going to http://localhost in your web browser.
in the run put mmc - on the consol file / add /remove item choose internet information service and under website turn off the iis
if you installed in the past wamp/mysql selete all and reinstall only the wamp
Click on the wamp server icon in the taskbar and test "localhost".
If that works, click the "phpinfo()" link on the page.
If that works too, your wamp server is working and you should be able to execute php files.
If not, you need to make sure it is installed properly and started properly.
Related
I have been developing a php project and the wamp server was seems
working fine but suddenly it stops working and i don't know what to do
because when i check its status it says server online and green icon is also
showing but it just does not work whenever i run .php files, Mr. browser
just write it down as i did in notepad++ but before some days it was working
fine, please help me I'm kinda stuck?
I also want to mention that in the mean while I installed tomcat server for some other work is it anything to do with fault because i'm pretty sure both operating on differnet port numbers
use <?php instead of <?or left click wamp > php > settings > short_open_tags
and make sure you are running your scripts through localhost and not just opening the php file in the browser
Read More about wamp problem
If you're definitely viewing the script through your MAMP setup (if your URL bar starts with http:// instead of file://) and it is showing the contents of the PHP file instead of executing the script, it sounds like Apache is running fine, but PHP-FPM is the issue or a misconfiguration between the two. Apache should detect it is a PHP script and ship it to the PHP-FPM process, accept a response then ship it to your browser.
I would recommend checking PHP-FPM logs first. All logs are in MAMP/logs - scroll to the bottom of each one for latest entries. Ensure the service is running as expected and logging hits when Apache serves a .php file. PHP-FPM may be using a socket file (which can hit permission problems) or on a network port (which can be in use/require admin privileges/etc). Otherwise check your config files, or re-install MAMP for fresh config files.
If Apache cannot start, common reasons are;
The port is in use by another application
The port is a low number and you do not have administrator privileges to use that port
Switching from wired to wireless / switching network adapters / changing hostname, etc
Apache is already running, or Apache thinks it is
You must sign out from Skype it'll occupied the port of Apache or you should turn down the server and then restart you pc and turn it on. It will work fine.
I had installed wamp server successfully but after starting all services it's not turning into green. I don't know exact problem also there is no port blocking problem.
Default Apache port 80 is not using by any other program.
I am trying to find out the error but not getting any.
All the error log files are empty.
I also checked mysql port and don't have any issue.
Did you have WAMP instaled before on this current windows machine?
Did you select the explorer.exe when promted?
I had same problem after i tried to instal wamp on same location where the last one was.
You need to uninstall the current wamp, delete the folder, clean you system registries and junk files, use ccleaner for this and then instal wamp again.
I know you are professional but I will give this suggestion considering that you still beginner :
remove this one completely and reboot your machine then create new folder ,if you have tow or three partition , create it in D and name it for example wamp.
when you start installation make sure that you select correct path to your folder wamp and when you write a server name , just write localhost without .com then write the user user#localhost and make password.
after that type at browser localhost and see what what happened.
I'm starting to get crazy with this.
I have to do some modifications to a wordpress website that i didn't create. I have access to the hosting so I downloaded all the files and a copy of the database.
After creating and importing in the local database I went to wp-config.php and change the hosting parametres (user, pass, server,...) for the local ones.
But here comes the troubles. When I change the online server dbXXXX.db.1and1.com to localhost it suddenly stops working and files called index.php won't ever work again
(I get "localhost server not found" error),
even if I change the source folder, or restart MAMP or restart the laptop... The only solution is to unistall MAMP, restart the system and install it again, but when changing the name of the server to localhost it happens again...
Well... If I copy the content of index.php in another file (for example index2.php) and set the parameters to the online server it works again until I change server to localhost.
When I say "it works" means that at least I get "error database connection" from wordpress (due to the online hosting does not allow external requests to its databases).
Can somebody help? Do you need some extra information? Thanks!
MAMP did some crazy this on my PC to, so I decided to switch to WAMP -
http://www.wampserver.com/en/
You may give it a try ?!
Finally I found the error. It's due to the file ".htaccess" that Wordpress (or I don't know who) creates for using permalink and MAC OS X.
When unzipping the web downloaded from the hosting the OS deleted that file because only system files can start with a dot (".htaccess").
I didn't find the solution and just start to work in Windows with BootCamp and all was fine. I was in a hurry to finish this job so I didn't have more time to try new solutions.
So I have not the solution but the source of the problem. Hope this helps someone at least finding the problem and save some time.
So I installed XAMPP and it worked fine at first (At least I think so. I typed in localhost and got the XAMPP page).
I have the files for the site I'm working on in my Dropbox folder so they stay up to date across my computers. I was looking for a way to point XAMPP to my working folder so I didn't have to work in htdocs and then move it back to Dropbox.
I found this thread:
Make XAMPP/Apache serve file outside of htdocs
And I followed cmcculloh's answer on how to set up a virtual host.
As the last step in his instructions said, I restarted Apache.
Except it won't start.
I click Start in the control panel and it says 'Starting apache service...'
....and it sits there
After Googling about it I saw tips like disable make sure port 80 is clear and disable anti-virus. And use 'netstat -nab' in a cmd prompt to check if something is using port 80
Well AvastSVC.exe is using port 80. What I don't get is why it worked fine after I installed it, with Avast running.... But it wasn't until I tried to restart that suddenly Avast is getting in the way.... So I'm not so sure that that's the problem.
Maybe it's something I did when I was trying to set up the virtual host?
I just want to test php without uploading to a web server D=
Edit:
Oh and btw, I closed Avast and made sure the process was gone but it still shows up under 'netstat -nab'. I looked under Services and there is still an Avast service but it won't let me stop it =S
If this is just for testing/learning/development purposes, perhaps you could try using EasyPHP and set an alias to the Dropbox folder with the HTML files within. Also, I recommend you use port 8080 for development, not port 80.
How do I actually run a file on localhost?
I know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost?
Server newbie here, additional questions (I have xampp running Apache 2.2):
From your responses it sounds like I have to type in the path in the browser in order to open the file on the localhost. So, if I want to have the file in a subdirectory, I would have to type the full path including the directory?
Is there a way to have the browser point to the localhost while I am working on my html, instead of having to type in the path all the time?
I am working in Dreamweaver CS3, and want to use include commands (either SSI or PHP), but not have to keep putting my files up on HostGator in order to see if they are working.
What is the best way to do this (please be specific, I know nothing). If there is a detailed tutorial anywhere, really appreciate a link.
Thank you
Ok, thanks for the more specific info, ppl may remove their downvotes now...
What you are proposing is a very common thing to do! You want to run your web application locally without uploading it to your host yet. That's totally fine and that's what your Apache is there for. Your Apache is a web server meaning its main purpose is to serve HTML, PHP, ASP, etc. files. Some like PHP; it first sends to the interpreter and then sends the rendered file to the browser. All in all: it's just serving pages to your browser (the client).
Your web server has a root directory which is wwwroot (IIS) or htdocs (apache, xampp) or something else like public_html, www or html, etc. It depends on your OS and web server.
Now if you type http://localhost into your browser, your browser will be directed to this webroot and the server will serve any index.html, index.php, etc. it can find there (in a customizable order).
If you have a project called "mytutorial" you can enter http://localhost/mytutorial and the server will show you the index-file of your tutorial, etc. If you look at the absolute path of this tutorial folder then it's just a subfolder of your webroot, which is itself located somewhere on your harddrive, but that doesn't matter for your localhost.
So the relative path is
http://localhost/mytutorial
while the absolute path may be
c:/webservices/apache/www
or
c:/xampp/htdocs
If you're working with Dreamweaver you can simplify the testing process by setting up your local server as a testing server in your project settings. Try it! It's easy. Once it's done, you can just press the browser icon with any of your files and it will open on localhost.
You can do it by running with following command.
php -S localhost:8888
I'm not really sure what you mean, so I'll start simply:
If the file you're trying to "run" is static content, like HTML or even Javascript, you don't need to run it on "localhost"... you should just be able to open it from wherever it is on your machine in your browser.
If it is a piece of server-side code (ASP[.NET], php, whatever else, uou need to be running either a web server, or if you're using Visual Studio, start the development server for your application (F5 to debug, or CTRL+F5 to start without debugging).
If you're using a web server, you'll need to have a web site configured with the home directory set to the directory the file is in (or, just put the file in whatever home directory is configured).
If you're using Visual Studio, the file just needs to be in your project.
Localhost is the computer you're using right now. You run things by typing commands at the command prompt and pressing Enter. If you're asking how to run things from your programming environment, then the answer depends on which environment you're using. Most languages have commands with names like system or exec for running external programs. You need to be more specific about what you're actually looking to do, and what obstacles you've encountered while trying to achieve it.
Looking at your other question I assume you are trying to run a php or asp file or something on your webserver and this is your first attempt in webdesign.
Once you have installed php correctly (which you probably did when you got XAMPP) just place whatever file you want under your localhost (/www/var/html perhaps?) and it should run. You can check this of course at localhost/file.php in your browser.
Think of it this way.
Anything that you type after localhost/ is the path inside the root directory of your server(www or htdocs).
You don't need to specify the complete path of the file you want to run but just the path after the root folder because putting localhost/ takes you inside the root folder itself.
i am working in VScode currently. i was wanting to run my html page just to see all my main elements.
1) first, in vs, right click desired html file and choose "copy path". do not choose relative.
2) finally, paste html path in address bar (i used chrome) and hit enter. your html page should display. hope this helps someone out.