I'm new to php, I did installed xampp-win32-1.8.2-2-VC9-installer on my window7 desktop pc. PHP page run from C:\xampp\htdocs but when i create virtual host and tried to access php file in d:\web\ it shows access forbidden.
my host file code
127.0.0.1 localhost1
my httpd-vhost file code
NameVirtualHost *
<VirtualHost *>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost localhost1:80>
DocumentRoot "d:/web/test.php"
ServerName localhost1
<Directory "d:/web/test.php">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I don't know now where i have to change
It's a file permissions derived issue. Try changing NTFS permissions in "C:/xampp/htdocs" to allow read and execute permissions to the user that is running the web server, you should be able to see who that user is in the Apache configuration file, tipically "apache" which is the equivalent to IUSR in IIS.
Related
I use Windows 10 and XAMPP for local development. I want to create project on laravel 5.5 and access it in browser by project.dev
I add next lines to httpd-vhosts.conf file
<VirtualHost project.dev:80>
DocumentRoot "C:\xampp7\htdocs\server\laravel\project_name\public"
ServerAdmin project.dev
<Directory "C:\xampp7\htdocs\server\laravel\project_name">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and
127.0.0.1 project.dev
to hosts file. But it does not work (only for laravel),I get 400 error.
This works with all the rest my local projects except those ones on laravel.
I have no problem with access to this project by
http://localhost/server/laravel/project_name/public
What other settings do I have to make to access laravel 5.5 project like project.dev?
1- change VirtualHost project.dev:80 to VirtualHost *:80
2- change ServerAdmin project.dev to ServerName project.dev
and after these changes restart your apache service
I know I'm probably missing something simple, but I've exhausted all resources trying to get this working.
I'm running my Apache on Port:5000 and trying to direct to lsapp.dev instead of http://localhost:5000/lsapp/public/ with:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/lsapp/public"
ServerName lsapp.dev
</VirtualHost>
I have tried VirtualHost *:5000 but still can't get it work?
you can use this on command line in your project root
php artisan serve --port=your_port_number
or do this:
edit httpd-vhosts.conf that is located in C:\xampp\apache\conf\extra\httpd-vhosts.conf and add following lines at the end of the file:
# VirtualHost for LSAPP.DEV
<VirtualHost lsapp.dev:80>
DocumentRoot "C:\xampp\htdocs\lsapp\public"
ServerAdmin lsapp.dev
<Directory "C:\xampp\htdocs\lsapp">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
our apache is listening to lsapp.dev connections, but we have to configure our hosts file that allows to redirect lsapp.dev to the localhost that is located in C:\Windows\System32\drivers\etc
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 lsapp.dev
Set your Virtual host file like this.
<VirtualHost *:80>
DocumentRoot "D:\laravel Task\laravel\blog" //here set your project storage path
ServerName localhost.test.com // set your url for your project
<Directory "D:\laravel Task\laravel\blog"> // again set your project storage path
AllowOverride All
Order allow,deny
Allow from all
Require all granted
set your hosts file like this
127.0.0.1 localhost.test.com
Now you can Run your project
localhost.test.com
//OR//
If you dont want to use virtual host, then you can run your project like this
goto your project folder=>
command line in your project root=>php artisan serve
your project will run in
http://127.0.0.1:8000/
I am working on an android application witch connect to an web api written in php.
I setup a subdomain by this configuration in my httpd-vhost conf file:
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www/Clinic"
ServerAlias Clinic.localhost
ServerName Clinic.localhost
<Directory "c:/wamp/www/Clinic">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
this setting work when I connect to that like this :
http://clinic.localhost:8080
but now I want to connect to this API from android device. there is no dns server and I must connect to this API by server IP now when I am trying to connect by this url:
http://192.168.1.102:8080/clinic
I get 404 error and my system cannot resolve host.
I found the reason. in my httpd-vhost config file i have not a virtual host for my root and because of this apache could not recognize host root folder. I add this config to my config file and every things is ok.
<VirtualHost *:8080>
DocumentRoot "c:/wamp/www"
ServerAlias localhost
ServerName localhost
</VirtualHost>
I'm using WAMPSERVER to run a wordpress site that has to be acessible by the users in my network, like a environment for testing together.
Localhost works fine, but at first i couldn't access the aplication from other computers in the network. I created a rule to open the port 80, created an Alias in the Apache configuration, and it worked but the theme and any images inside subfolders wouldn't load and the console was returning lots of 404 responses.
I want to map the subfolders and its files that are under the 'base dir' of the site. I tried tons of options in the Apache conf. file but i couldn't make it.
Attached a printscreen of the responses, the apache conf file and the windows hosts file
Httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#animamidia
DocumentRoot "C:\wamp\www\website"
ServerName www.animamidia
ErrorLog "logs/animamidia-error.log"
CustomLog "logs/animamidia-access.log" common
<Directory "C:\wamp\www\website\*">
Options FollowSymLinks Includes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Windows hosts file:
127.0.0.1 www.animamidia
The site with it's theme broken because the requisition returned a 404
Well i found the problem.
Even though i couldn't enter the wordpress-admin i decided to check the 'wp-config.php' file just in case something is wrong or missing.
And what i did find is that the 'Home-URL' and the 'WP-URL' were set at 'localhost/website' which means that all the requisitions would point at this location as a base directory.
All i had to do was to use the 'define' comand and set the site's URL to the machine's IP and now the environment is all set up for the guys over here to develop and test their stuff.
Do I need to update my host file and apache httpd.conf files manually whenever I create a new zf project using command.
For ex: if my new project is zendi.
in host file:
127.0.0.1 localhost zendi
in httpd.conf:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
DocumentRoot "C:\wamp\www"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1>
DocumentRoot "C:\wamp\www\zendi\public"
ServerName zendi
ErrorLog "C:\wamp\logs\apache_error.log"
<Directory "C:\wamp\www\zendi\public" >
Options Indexes FollowSymLinks
AllowOverride all
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
If you are using PHP 5.4, then you can use the built-in web server, and you don't even need Apache.
http://php.net/manual/en/features.commandline.webserver.php
If you need to use virtual host for your newly created zf application then the answer is YES you need to configure it manually command line project creation doesn't configure it for you. But if you don't need to have virtual server for every application you create then you can skip the process and go with direct url:
localhost/zendi/public
(But it is often considered good practice to have virtual hosts configured for the projects that you'll be working for a while)