This is my problem:
- I downloaded and installed XAMPP;
- I changed the listen port from 80 to 100 (to not interfere with Skype);
- in browser i typed: localhost:127.0.0.1:100
WAMPP page appears. So far so good. I opened NetBeans and tried to run a PHP application and I got Error 404.
Apache service is running (at least XAMPP reports soand the Apache icon is showing).
I use Win 7 on laptop, 64 b.
So, what can I do to successfully run the application.
Tank you,
Eugen
Do you have
Listen 81
in \xampp\apache\conf\httpd.conf ?
Or do you have the vhosts properly configured?
<VirtualHost *:100>
....
Do you have mod_rewrite enabled in httpd.conf?
LoadModule rewrite_module modules/mod_rewrite.so
Related
In my mac terminal I typed:
vagrant up
vagrant ssh
after which my command prompt is inside vagrant and displays:
vagrant#zero-to-slim:~$
after which I type:
vagrant#zero-to-slim:~$ cd /vagrant
where I have created a php file (called hello.php)
<?php
echo "Hello World from inside vagrant!!";
?>
When I go to firefox and type /var/www I can see the contents of the directory:
(i) a folder named zero-to-slim.dev
(ii) index.html
(iii) hello.php
I want to enter (in my browser) localhost/hello.php and be able to see "Hello World from inside vagrant!!", which is clearly not happening. How do I make that happen? FYI, just typing localhost in firefox displays: "It Works!" I'm not using PuPHET or anything, just LAMP.
Also I think the problem is I have to direct my host OS Apache to look at some shared folder to render .php files. No idea how to do that either (new to LAMP dev)
OSX comes with PHP pre-installed but not configured. You have to do that yourself.
According to Using the bundled PHP on PHP.net:
PHP has come standard with Macs since OS X version 10.0.0. Enabling PHP with the default web server requires uncommenting a few lines in the Apache configuration file httpd.conf whereas the CGI and/or CLI are enabled by default (easily accessible via the Terminal program).
and it goes on to say that you start by uncommenting the lines mentioning php in /private/etc/apache2/httpd.conf, e.g.,
# LoadModule php5_module libexec/httpd/libphp5.so
# AddModule mod_php5.c
and restart Apache.
This morning I started using HHVM as my default local server. Most things are fine, but I still have applications that HHVM doesn't fully support yet.
Rather than changing my configuration and restarting services, it would be much easier if I could just switch ports or directories.
My Question: Is it possible to run a normal Apache server on one port (80) and a HHVM powered server on another port (8080)? Alternatively, is it possible to only run HHVM in a specific directory (and its' sub-directories)?
In scenario 1 switching to HHVM application would look like this:
localhost/my-project/index.php
localhost:8080/my-project/index.php
In scenario 2 switching to HHVM application would look like this:
localhost/my-project/index.php
localhost/hhvm/my-project/index.php
I would guess that this can be achieved via Apache's config file, but I don't know enough about how the config files work to do it myself, please help!?
OS: Ubuntu 14.04
Apache Version: 2.4.7
HHVM Version: 3.2.0
To /etc/apache2/ports.conf add...
Listen 8080
Then, to your vhost configuration (since using localhost as your domain, probably /etc/apache2/sites-available/default.conf), copy everything in there and paste it right below so you have a second VirtualHost instance. To the second instance, change the *:80 to *:8080, then add your ProxyPassMatch to tell it you're wanting to use HHVM for hh and php file extensions (don't forget to update to correct directory).
It should look something like...
<VirtualHost *:80>
... keep the same ...
</VirtualHost>
<VirtualHost *:8080>
... keep the same ...
ProxyPassMatch ^/(.+\.(hh|php)(/.*)?)$ fcgi://127.0.0.1:9000/var/www/$1
</VirtualHost>
Go into /etc/apache2/mods-available/hhvm_proxy_fcgi.conf and comment out what's in there. Otherwise everything will be headed toward HHVM.
Finally, restart apache
sudo service apache2 restart
I tested this quickly on an existing local site and it was redirecting back to 80 from 8080 which it should have done. If this doesn't work out, let me know.
UPDATE: Tested a bit more, and it looks like this should work out for you. After adding the following, jumping between local.site.com/hhvm.php and local.site.com:8080/hhvm.php flipped the echo correctly.
<?php if (defined('HHVM_VERSION')) {
echo "golden!";
} else {
echo "doh...";
}
Yes. You can have Apache listen on both port 80 and port 8080 (just add in additional listen configurations), then add a virtual host for localhost:8080 that passes requests off to HHVM through FastCGI.
I am new in php and now i installed wampserver 2.2 application and when i click to Localhost option, the "Unable to connect" page shown in my Firefox browser.
this is my www folder:
And this is my index.php file:
<html>
<head>
<title> Hello To PHP Learning! </title>
</head>
<body>
<?php
echo 'Hello World';
?>
</body>
</html>
Have you installed the C++ Redistributable Package ?
You should install it before installing wamp!
Did you Tried
127.0.0.1
instead of localhost
IIS and Apache/Wamp are both web server and might conflict in some way, so you have to disable IIS in order for Wamp to work
Disable IIS :
Control Panel, Uninstall Programs, Turn Widows Features On or Off, uncheck Internet Information Services
if using skype, open skype > tools > options > connections > advanced > untick "use port 80 ..." then restart wamp then skype
There might be port problem in httpd.conf change it to 80 instead of other
ON LINE NO 40+
LISTEN 80
OR TRY TO CONNECT
The last but not least method
Try to uninstall WAMP Server and reinstall it in another Drive except same drive.
Your wamp server should be started (green icon in the tray), the Apache and PHP services should be ON.
In most of the cases wamp server launches Apache on default 80 port, which might be used (for example from Skype) when you try to start Apache, so kill processes that listen on port 80 before launching wamp.
Causes for ’404 error in wamp server’:
This problem happening for Port issue. You may be install some services which one taking Port 80. Like,
Skype
IIS Express Web Server
Some Torrent Clients
Teamviewer
...
So only ‘HTTP 404 error page not found’ happening.
Solution:
You have to change your wamp server Port number. Just do following simple steps,
Open httpd.conf file
After run your wamp server, left click taskbar Wamp green icon. Then go-to Apache->httpd.conf
(Otherwise open like: C:\wamp\bin\apache\apache2.2.22\conf )
Change Listen 80
There, Line number 46 having “Listen 80″.
Just replace 80 as “81″ like
Listen 81
Change ServerName localhost:80
And Line number 171 having “ServerName localhost:80″.
Just replace with same number as you used Line number 46. Like,
ServerName localhost:81
And save this file.
Use URL
Just restart your Apache or Wamp then use URL like following,
localhost:81 or
127.0.0.0:81 ( here 127.0.0.0: is your wamp IP )
localhost:81
When I make local changes to my PHP / WordPress website, the localhost does not seem to update for 20-30 minutes.
I'm on Mac OSX 10.8.4 and using MAMP Pro. I have two sites that I have created separate host entries for, let's call them mysite1.dev and mysite2.dev.
Here is my MAMP Server configuration:
Apache: 80
MySQL: 3306
SSL: 443
I saw this article ( How can I eliminate slow resolving/loading of localhost/virtualhost (a 2-3 second lag) on Mac OS X Lion? ) on the Bonjour conflicts and edited my /private/etc/hosts file with the suggestions in this article:
I changed the host names from mysite1.localhost to mysite.dev because it sounds like the conflict is with .local names - DID NOT WORK
I updated the Hosts file to have separate ::1 addresses - DID NOT WORK:
::1 <tab> mysite1.dev
::1 <tab> mysite2.dev
I tried putting all of my host entries onto one line - also didn't work:
127.0.0.1 localhost mysite1.dev mysite2.dev
::1 localhost
fe80::1%lo0 localhost
It seems like MAMP Pro overwrites the hosts file any time I restart the server.
I would be SUPER grateful for any help you can offer.
Change MAMP cache to OPcache. It worked for me
I had the same problem and found the solution on this post: MAMP time between seeing live changes
The instructions, which I followed:
The solution is uncommenting lines in the php.ini file, which can be found in
/{MAMP Directory}/bin/php/php5.5.3/conf/php.ini
Comment out Opcache:
[OPcache]
;zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
; opcache.memory_consumption=128
; opcache.interned_strings_buffer=8
; opcache.max_accelerated_files=4000
; opcache.revalidate_freq=60
; opcache.fast_shutdown=1
; opcache.enable_cli=1
Documentation ( yes it started in 5.5 ):
http://www.php.net/manual/en/intro.opcache.php
I've been struggling with this issue ever since switching to SSL for my local environment (thanks, Salesforce API) and finally found a solution that worked for me:
Turning off Xdebug cut TTFB from 25 seconds to 2. Yeesh.
I had similar problems running php 5.5.3. After I changed back to 5.4.19 it worked.
You can change the version in the MAMP GUI. You might have to rename your 5.5.3 folder to 5.5.X for 5.4.19 to show up in the GUI. The php folders are placed at: Applications/MAMP/bin/php
For me, changing back to MAMPS standard port settings did the trick.
The solution that worked for me was to turn off Xdebug as #tammy-shipps mentioned. However since I have the vanilla MAMP version, I had to turn off Xdebug with the php.ini file found here:
/{MAMP Directory}/bin/php/{PHP Version}/conf/php.ini
Then change xdebug.remote_enable from 1 to 0:
xdebug.remote_enable=0
Unlike other proposed solutions, turning off cache or changing ports had no affect on the problem.
MAMP's default ports are non-standard. When I switched to standard ports (80 for Apache & 443 for SSL), it sped up dramatically.
I'm not sure if this is what Paul Bakker did, or if he switched the other way.
I'm using MAMP Pro 4.2, PHP 7.1.6, Apache, OS X 10.11.6.
It was really hard, but I found a solution that it works in my environment:
MAMP 4.2.1
PHP 5.6.31
SETTINGS left menu > Ports settings > Run servers as: > Change it to "Unix Users" option.
Setting xdebug.remote_host to to 127.0.0.1 instead of "localhost" solved this issue for me. This skips IPV6 resolution, which caused the delay.
Switching off remote_enable is not an option, because it kills debugging in PHPStorm:
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
I'm not sure about Mamp, however, I use php -S 0.0.0.0:4444 to spin up a local server. Its response got very slow after moving to Mojave.
I was able to fix it by updating /etc/hosts file with
::1 localhost YouMacName.local
127.0.0.1 localhost YouMacName.local
You can get YourMacName.local by running in terminal:
$ hostname
I was having same issue, I had added virtual host ending with .local which was causing 5 seconds delay in lookup.
To fix this I updated host file.
sudo nano /etc/hosts
And added my site with IPv6 address along with ::1 and 127.0.0.1.
::1 mysite.local
127.0.0.1 mysite.local
fe80::1%lo0 mysite.local
Switch off the
PHP-Cache
as shown below screenshot.
Below in the screen shot you can see
I installed mod_geoip2 apache module, and can see it in Loaded Modules in phpinfo(); However, in Apache Environment my GEOIP_ADDR is 127.0.0.1. My REMOTE_ADDR is correct remote address.
I also have nginx on frontend that could cause problem.
What am I doing wrong?
After several hours of googling, found it, finally.
My problem was that the apache's module mod_rpaf (which tells apache real IP) was loaded AFTER mod_geoip.
All I had to do is to rename
mod_rpaf.load --> 00mod_rpaf.load
mod_geoip.load --> 01mod_geoip.load
in apache's mods-enabled directory. And restarted Apache. Works like a charm, now!