I have a project developed on symfony 2.4 that run on correctly on my main computer using WAMP.
However, I need to move it to my laptop MacOS Mojave (v 10.14.5). To do that I install MAMP and try to set the virtual host.
Here the steps I did:
1. Installed MAMP 5.4 and set the port as default:
Apache port : 80
MySQL Port: 3306
Updated the hosts file located at /private/etc/by adding the following code:
127.0.0.1 mysite.fr
::1 mysite.fr
Updated the file httpd.conf located at /MAMP/conf/apache by removing the # before Virtual hosts line:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
4.Updated the file httpd-vhosts.conflocated at /MAMP/conf/apache/extra/ by adding the following code:
<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs/mysiteSymfony2.4/web"
ServerName mysite.fr
</VirtualHost>
Restart MAMP
Open my browser and move to the url mysite.fr
My Virtualhost setting on my Mac and my Windows are exactly identical. However, it's works on my Windows only, here the error message I get on my Mac at mysite.fr
Not Found
The requested URL / was not found on this server.
Related
I want to run my laravel 9 app without 'php artisan serve'
i know how to do it in older version but laravel 9 don't have the server.php file in root directory
so how to do it now
and i don't want to use 'localhost/project/public/' url
I am currently on
laravel: version 9.19
OS: Ubuntu 22.04.1 LTS
php: 8.1.2
Server: Apache/2.4.52 (Ubuntu)
First step is to add your project to list of virtual hosts in XAMPP that is located in \apache\conf\extra > httpd-vhosts.conf
It can be something like:
<VirtualHost *:80>
DocumentRoot "{pathToProject}\public"
ServerName projectname.localhost
<Directory "{pathToProject}">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Second step is to add host in your hosts file that is located in same disk as your OS then \Windows\System32\drivers\etc > hosts
It should probably be something like
127.0.0.1 projectname.localhost
If you've changed default address settings, you will have to change address in hosts as well.
Restart XAMPP and you're good to go.
I'm learning Laravel PHP. So I followed a tutorial on YouTube about creating a virtual host for XAMPP Apache server and I tried to modify httpd-vhosts.conf file in XAMPP/apache/conf/extra. My project directory is "D:\Applications\XAMPP\htdocs\www\EpsilonProgram" so how do I set the DocumentRoot in httpd-vhosts.conf? If I set as
DocumentRoot "D:\Applications\XAMPP\htdocs\www\EpsilonProgram"
and then turn on XAMPP Apache server and run
http://localhost/
, it always displays
Forbidden
You don't have permission to access this resource.
Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/8.0.8 Server at localhost Port 80
Please help!
I have a Symfony2 application using MongoDB. It is running fine in the other two PCs - Windows 7 and Linux. I'm migrating it into a new laptop. Its environment is
Windows 10 Pro
XAMPP 3.2.2
Apache 2.4
PHP 7.0.13 (php_mongodb extension 1.2.1 enabled)
MongoDB 3.4
I successfully run the application at http://localhost:8000 by running php app/console server:run. However, I setup virtual host, let's say api-site.dev and when I run http://api-site.dev, I got the httpd.exe application error and unfinished page loading.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "D:\xampp\htdocs"
</VirtualHost>
<VirtualHost *:80>
ServerName api-site.dev
ServerAlias api-site.dev
DocumentRoot "D:\xampp\htdocs\api-site\web"
</VirtualHost>
I will have to setup virtual host because it is an API server and it is needed to call from another Symfony application with MySQL database. I added the following virtual host for the another app example.dev and it is running fine.
<VirtualHost *:80>
ServerName example.dev
ServerAlias example.dev
DocumentRoot "D:\xampp\htdocs\example\web"
</VirtualHost>
The problem persists only for the virtual host api-site.dev. It is strange and I have no idea what I should do next.
[UPDATE]
I traced /web/app.php and found the problem occurred at the line $response = $kernel->handle($request); when die('hello') is removed.
$request = Request::createFromGlobals();
die('hello');
$response = $kernel->handle($request);
die('hi');
$response->send();
$kernel->terminate($request, $response);
It may be because of XAMPP 7.0.13 with PHP 7.0.13 problem with Windows 10.
I solved the problem by installing WampServer (x64) 3.0.6 which includes
Apache 2.4.23
PHP 5.6.25 / 7.0.10
MySQL 5.7.14
I re-configured everything with WAMP and now working fine.
i have basic Vagrant box with following configuration
Static IP: 192.168.55.155
Ubuntu 14.04
PHP 5.5.16
Apache 2.4.10
Port forward: 8081 on host to 80 on the guest system
My host system is "Windows 7" and the "hosts" file in Windows 7 contain following line "192.168.55.155 phpinfo".
I set up a basic vhost like this.
<VirtualHost *:80>
ServerName phpinfo
DocumentRoot "/var/www/info"
<Directory "/var/www/info">
</Directory>
</VirtualHost>
I created this vhost file on my guest system "/etc/apache/sites-availble" and create a symbolic link in "/etc/apache2/sites-enabled" to my new file. After creating this vhost i restart my apache server "/etc/init.d/apache2 restart".
If i write in my browser on my host machine the url "phpinfo", the content of my php file do not parse from the browser. It display following:
<?php
echo "hello world";
?>
But if i write as url "localhost:8081" the port forwarding to 80 on my guest systems work and the default host content from "/var/www/default" like "hello world" parsed from my browser.
Now i do not know the problem, because the guest system parse php on the default vhost, but not for my custom vhost.
Can anybody help me?
You need to do this.
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
I have just started using laravel and a mac to develop websites. I have gone through the setup and tried following a phpacademy tutorial.
My problem is that when i try and access the localhost, as default i get the index page where all my folders are stored and when i enter my direct path e.g. laravelpractice.local in the web browser i get the error that i mentioned in the title.
i have edited the /etc/apache2/httpd.conf and the /etc/hosts to create a virtual host and create a custom url respectively and the spelling seems to be fine.
/etc/hosts file open. You must be the owner of the file.
127.0.0.1 localhost.localdomain localhost
after add
127.0.0.1 laravelpractice.local
000-default.config file save. After /etc/apache2/sites-enabled/000-default.config file open. You must be the owner of the file. Add to the bottom
<VirtualHost *:80>
DocumentRoot "/var/www/laravelpractice/public/"
ServerName laravelpractice.local
</VirtualHost>
Apache restart with terminal:
sudo service apache2 restart
Open browser and url : laravelpractice.local