I have installed Xampp 7.2.34 from https://www.apachefriends.org in Big Sur.
XAMPP htdocs folder is placed in /Applications/XAMPP/xamppfiles directory. Is there anyway that I can change the location of htdocs folder and place all my projects in the new location.
Current Location: /Applications/XAMPP/xamppfiles/htdocs
Desired Location: /Users/user/Desktop/Work/PHP/htdocs
I am following this question in Stackoverflow but it seems quite old and I was not able to accomplish what I required.
Already done:
Created new empty htdocs folder on desired location
Changed User daemon to User user in xamppfiles/etc/httpd.conf
Didn't change Group daemon
Changed DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs" to DocumentRoot "/Users/user/Desktop/Work/PHP/htdocs" in xamppfiles/etc/httpd.conf
Changed <Directory "/Applications/XAMPP/xamppfiles/htdocs"> to <Directory "/Users/user/Desktop/Work/PHP/htdocs"> in xamppfiles/etc/httpd.conf
I also uncommented this line of code Include etc/extra/httpd-vhosts.conf in xamppfiles/etc/httpd.conf
Result:
Access forbidden! error.
What did I miss? Has something changed in these years? TIA.
I have the same issue, but worked with this this solution. You could using Xampp in another version, Xampp 7.4.15 with this configuration
This worked for me using XAMPP 8.2.0 and macOS 12.6.2 Monterrey:
Make a copy of htdocs and put it where you want it. In my case, I made my copy in /Users/me/Dropbox/XAMPP/htdocs
Edit /Applications/XAMPP/xamppfiles/etc/httpd.conf
Change
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs”
to
DocumentRoot "/Users/me/Dropbox/XAMPP/htdocs"
Change
<Directory "/Applications/XAMPP/xamppfiles/htdocs”>
to
<Directory "/Users/me/Dropbox/Programming/XAMPP/htdocs">
Change
User daemon
to
User me (your user name)
Edit /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php
After
$cfg['SaveDir'] = '';
add
$cfg['TempDir'] = '/tmp';
Edit /Applications/XAMPP/xamppfiles/properties.ini
Change
apache_htdocs_directory=/Applications/XAMPP/xamppfiles/htdocs
to
apache_htdocs_directory=/Users/me/Dropbox/Programming/XAMPP/htdocs
Save the files and restart the servers.
That was it. Hope helps someone. I looked for this answer for a long time.
Related
I have some PHP web apps running off XAMPP 7.4.1 on macOS 10.15. XAMPP has worked for me in the past. I got my dev environment screwed up because 32 bit apps sh*t the bed with Catalina, and my old XAMPP installation didn't open. I got my VirtualHosts set back up, but now when I try to access one of my sites I get the following error.
Access forbidden!
You don't have permission to access the requested directory. There is
either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
My virtual hosts look like the following:
# localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#####################
# PERSONAL PROJECTS #
#####################
# Dunsparce.net
<VirtualHost *:80>
ServerName dunsparce.net
DocumentRoot "/Users/danielschnoll/Documents/Projects/Dunsparce.net"
<Directory "/Users/danielschnoll/Documents/Projects/Dunsparce.net">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dunsparce-error_log"
</VirtualHost>
I have more VirtualHosts listed and they all follow the same format. I have Require all granted on each one, as well as the Allow Override All and the Options... line. Like I said at the start of the post, they all worked in the past. I also have the # Include uncommented in my httpd.conf file, though I'm pretty sure Access Forbidden error is completely unrelated to it.
Any ideas?
I wound up having to edit httpd.conf again. There’s a section for User group permissions. By default it says
User daemon
Group daemon
Change the User from daemon to your macOS Username. For me, my User group now looks like
User danielschnoll
Group daemon
If you landed here after an Upgrade to MAC OS my problem was solved when I moved the web files out of the /Documents/ folder.
How to Fix XAMPP Error 403
Step 1: Open the Volumes tab in the XAMPP app
First, open the XAMPP app on your Mac and navigate into the Volumes tab
Step 2: Click on 'Mount'
Next, you're going to mount the opt/lampp directory onto your computer.
Step 3: Click on 'Explore'
Step 4: Open the 'etc' folder
By clicking on explore your app should have opened the lampp directory. In it you'll see many folders and files. Click on the one named 'etc'.
Step 5: Open the 'extra' folder
Step 6: Open the 'httpd-xampp.conf' file
Step 7: Find the AuthConfig requirements code
Search for 'phpmyadmin' in the httpd-xampp.conf code and find the following section:
httpd-xampp phpmyadmin require local
Step 8: Change 'Require local' to 'Require all granted'
This is the step that will fix the 403 error. Change the line of code to replace 'Require local' with 'Require all granted'. Then save your file.
Step 9: Restart all services
Navigate back to the XAMPP app and click on 'Services', then 'Restart all'. This will restart all of the services. You'll notice the status lights turn yellow and eventually return back to green.
Step 10: Refresh the phpMyAdmin page
The last step is to refresh the phpMyAdmin page you had open earlier.
If you closed it, no problem, just return to the General tab on your XAMPP app and click 'Go to Application'. That will open the dashboard in your browser where you can again navigate to the phpMyAdmin page.
Changing the User group permissions didn't work for me, but creating a Symbolic link to my working directory worked:
cd /opt/lampp/htdocs
ln -s /home/user/Projects/www www
Then in /opt/lampp/etc/httpd.conf
DocumentRoot "/opt/lampp/htdocs/www"
Follow below steps:
Go to htdocs folder
Right click on the folder and get info
Go to Sharing & Permissions: and >>> add your user
Your user : read & write
I have a custom website in Magento 1.9 running on my localhost, its Ubuntu 18. LTS , running on a php 5.6 and apache, everything works fine, but not the css
This is the url is loading:
http://local.mysite.com/var/www/html/mysite/skin/frontend/base/default/css/files.css
So as you can see it loads /var/www/html witch is wrong, this is my virtual hosts inside apache2 folder sites-available:
local.mysite.com.conf
<VirtualHost *:80>
# Admin email, Server Name (domain name) and any aliases
ServerAdmin webmaster#domain1.com
ServerName local.mysite.com
ServerAlias local.mysite.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/html/mysite
# Custom log file locations
LogLevel warn
ErrorLog /var/log/apache2/error-mysite.com.log
CustomLog /var/log/apache2/access-mysite.com.log combined
</VirtualHost>
Just for the record i have enabled mod rewrite
sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
Guys you can try this to solve the problem. I also faced the same problem it helped me
i redid all the steps that i have done before, like getting all the files from svn, re-importing the database, and changing the web/unsecure/base_url & web/secure/base_url, configuring apache virtual hosts etc..
but i think what solved the problem was changing the ownership of media and var directories to www-data instead of user and giving those folders full permissions.
I have done this step because in the main server, the those directories were owned by www-data user..
Also, i observed that the css was loading from zz.com/media/css folder, which was automatically created once the media directory was setup properly, which did not happen earlier, the directory has css files like 0a039da6028e6d636132ecd5e235f417.css etc..
the request url was something like this (from net window in firebug)...
http://zz.com/media/css/0a039da6028e6d636132ecd5e235f417.css
and not like the one i mentioned how it should be above (http://zz.com/skin/frontend/default/jm_wall/css/layout.css), nor like how the request was sent (http://zz.com/var/www/zz.com/skin/frontend/default/jm_wall/css/layout.css)
Hope this helps someone else...
I have PHP with Apache2 and I want to run Laravel Framework without Artisan but I can't! Does anyone know how to run Laravel without Artisan?
I've solved the problem. The problem was in my htaccess and in mod_rewrite (Apache2). Now I can connect to my application only by typing localhost/public..
If anyone wants to make the application public, the more easy and fastest way is:
Rename the "server.php" file in root directory, in "index.php"
Move your .htaccess from public folder to root directory
Make your directory accessible to Apache2 (set correct file/folder permissions).
Thanks to all users for help! :)
Important Edit
Consider using Apache Virtual Hosts (pointing the virtual host to the /public Laravel folder) instead of renaming server.php to index.php because by doing this you will need to prefix "public/" when you use the Laravel's asset() function in your views.
When working with other devs, who are using a different configuration, this might be a big problem because they will be able to see the assets while you will not (or viceversa).
I am using xampp in mac
inside htdocs / run following command:
$ laravel new myblog
After successfully creation run following and do following:
sudo chmod -R o+w storage/
Change server.php to index.php (# root directory)
copy .htaccess from public to root directory
(optional) in resources / app.blade.php → Change to
<link href="{{ asset('public/css/app.css') }}" rel="stylesheet">
run following
http://localhost/myblog/
Easy solution without any code alterations
Point your domain to public/ folder of laravel project.
Enjoy!
~OR~
Create .htaccess in project folder and add below code. This code will rewrite domain to public/ folder of your laravel project
RewriteEngine on
RewriteRule ^(.*)?$ ./public/$1
Hope this is helpful.
Laravel framework is such a pain in the ass for startup PHP guys who are not much oriented about what the hell composer is, and where .phar files are coming from and what are they, and why "Artisan" is trying to ruin your PHP life.
Most people are looking for a PHP framework where all you have to do is download, extract and code.
Nevertheless to make things work, you just need to install Laravel through Composer:
composer global require "laravel/installer=~1.1"
Anyway, you can download Composer from http://getcomposer.org/
After you install Laravel through Composer, navigate to your local server's directory. You might want to use "CD" (Change directory) to do this. (I'm speaking of CLI, whether you're in BASH(Linux) or CMD(Windows))
Then create your very first Laravel project by typing this in command line:
laravel new mywebsite1
Replace "mywebsite1" with your first project name.
And there you go, you're ready to hit the Laravel road.
In my case, I'm still using Windows XP in such development and shifts back to Ubuntu Trusty whenever I feel like I want to smell Linux scent.
So Composer installs "Laravel installer" in:
%userprofile%\Application Data\Composer\vendor\bin
So I make a backup copy of this directory so the next time I use Laravel on other unit with no internet connection, I just have to extract it, and run:
laravel new [myprojectname]
within the same directory and copies the resulting folder to my XAMPP's htdocs or WAMP's www folder.
Anyway I'm just sharing my approach for those with no 24/7 internet connection at home :p
After all it's still best for everyone to read the documentation on how to properly install Laravel: http://laravel.com/docs/5.0/installation
For Windows Users Its very easy to change and run laravel projects on your normal project urls :
1. "server.php" to "index.php" .
2. copy ".htaccess" from public to root directory.
there you go with your normal URL .
localhost/project_name
Artisan is simply a command line interface. It is made to do things like create and run migrations and automate building certain objects within your Application, etc. Essentially, it's only made to help facilitate creating and working on your Application, not run it.
If you are having issues actually getting the Application to run, it is likely a problem with either your PHP or Apache, not Artisan.
Just Follow 3 Step ;
Change File Name : change serve.php to index.php inside your Project name folder.
Move .htaccess file Bring ".htaccess" file to main root [inside your Project name folder ].
Restart your local server. Your are just 1 click away . Restart all services of xampp or wamp
Enjoy
For an aternative maybe you can run it under a virtual host. All you need is just create a new virtual host with your project/public directory as a DocumentRoot.
In my case, I am using XAMPP under Mac OS. These are the steps on how to achieve that:
Enable virtual host config
Ensure virtual host config was enabled, else you can enable it through this file: /Applications/XAMPP/xamppfiles/etc/httpd.conf
$ sudo nano /Applications/XAMPP/xamppfiles/etc/httpd.conf
Remove the hash "#" of this following line
# Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
Add a new virtual host
$ sudo nano /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf
The add a new virtual host (e.g: newproject.dev)
# Virtual host of newproject.dev
<VirtualHost *:80>
ServerName newproject.dev
DocumentRoot "/Users/your-username/newproject/public"
<Directory "/Users/your-username/newproject/public">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Note: /Users/your-username/newproject/public is the location of your project.
Update your hosts
$ sudo nano /etc/hosts
Add this following setting:
# Host of newproject.dev
127.0.0.1 newproject.dev
Restart your Apache, go to your browser and your project should be available on http://newproject.dev
I got mine to work by adding the following block to my apache vhost conf file
<VirtualHost *:8003>
ServerName myproject
DocumentRoot "/path/to/myproject/public"
</VirtualHost>
and running sudo chown -R daemon storage from my project root
Well , the easy way is
1) create a new folder"Project" and copy all files except public folder content to project folder
2) copy all files of public folder to root
and you can run laravel without artisan.If you rename server.php and copy .htaccess , it may make trigger some error when you try to run auth artisan command.I experienced problem with auth command.
Laravel with Vue.JS
If you are using vue.js with Laravel and your app is not working without php artisan serve, you need to create a virtual host. This is a simple two-step process for windows.
Step 1: Update you hosts file at C:\Windows\System32\drivers\etc with,
127.0.0.1 dev.example #You can rename according to your app
Step 2: Update you vhosts file with,
I am using Apache which is installed in D:\ so my path for vhosts file is at
D:\xampp\apache\conf\extra
<VirtualHost *>
DocumentRoot "D:\xampp\htdocs\example\public" ##Your path
ServerName dev.example ##Your URL according to what you set in hosts file in step 1
<Directory "D:\xampp\htdocs\example\public"> ##Your path
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
That's it, now you can just visit your app at http://dev.example/
Install and setup Laravel on your local (meaning your local machine).
Once done, copy all files to your hosting.
Create a .htaccess file on your Laravel's root directory. This is to access it without the "public" on the URL.
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
I'm following through the getting started skeleton app tutorial on the Zend homepage:
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
I've got as far as being able to enter into the browser address bar "zf2-tutorial.localhost/" and my Zend welcome page should appear. It doesn't, the apache web folder (/var/www) directory appears instead. If I enter "http://zf2-tutorial.localhost/1234" to test whether the Zend 404 page appears, it doesn't. The default apache Not Found page appears.
I created my app by running in terminal:
php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application:dev-master /var/www/zf2-tutorial
.. this created all the files in the desired folder (/var/www/zf2-tutorial).
I then created the file /etc/apache2/sites-enabled/zf2-tutorial with the following:
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I updated my /etc/hosts file with:
127.0.0.1 zf2-tutorial.localhost localhost
I restarted apache
sudo service apache2 restart
.. and by this point I should be able to see the Zend welcome page so I can proceed with the rest of the tutorial but nothing.
By the way, I'm using Ubuntu 12.04, Apache/2.4.9 (Ubuntu) and PHP 5.5.14.
Is there anything obvious that I've missed out? I've got a feeling that it has something to do with the mod_rewrites but I'm a little confused which I should be updated and how. Any help would be much appreciated.
Add the
<VirtualHost *:80>
[... same code ....]
</VirtualHost>
in the /etc/apache2/sites-enabled/000-default file and restart the apache2
Update -
If it still doesn't work then try the below command and check -
sudo a2enmod rewrite
sudo service apache2 restart
This will enable the rewrite module if not already is.
After entering the URL in the browser, if the required page is not displayed then check the apache error log file located at /var/log/apache2/error.log
By this, you could get some idea as where its going wrong.
Your problem was in config file name. In directory sites-enabled files should have .conf in the end of name.
Good: zf2-tutorial.conf
Bad: zf2-tutorial
I'm trying to install Bonfire for Codeigniter and I'm having some issues. I first tried downloading the zip, unziping it and placing it in MAMP and navigating to it through localhost. The welcome page came up but when I clicked on the "install" button, it displayed a "URL Not Found" page. Quite annoying since I'm under the gun.
I saw on youtube, that the dev team shows the install by cloning the repo on Github so I tried that next. Now when I load that in my localhost, I get a welcome page without an install button, an error saying my "htaccess" should be renamed ".htaccess" (although when I looked at the file it looked fine to me) but more worryingly is the next error:
"Oops!
Your Web Root should be set to the public folder,but it's not. It's pointing to the Bonfire Root folder.
See below how your site should be set up on Apache:
<VirtualHost *:80>
DocumentRoot "[...]/htdocs/Bonfire_Root/public"
ServerName Bonfire.Root
ServerAlias Bonfire.Root.local
</VirtualHost>"
I'm a really junior programmer and I'm just trying to get this sorted out quickly because of a project I'm on that I need to turn around quickly. I'm sure this is probably something simple so does anyone know what I can do to fix this so it will work and I can begin developing with Bonfire? Thanks in advance!
EDIT:
When I followed the instructions about adding my project name to the URL, I moved on to a blank page, Chrome initiated a download of a textfile called install which contains this:
J
5.5.34B:;Z1&hZˇ˜Äj*/Knh#G"o/9mysql_native_password!ˇÑ#08S01Got packets out of order
I'm not sure what to do with this. Any ideas?
I've tried:
http://localhost/Bonfire_Root/public/
http://localhost/Bonfire_Root/public/index.php
http://192.1xx.xxx.xxx/Bonfire_Root/public/index.php
Each time it just downloads the textfile with the same text in it. :/
here's my work around (I'm on linux btw):
1) make sure mod_rewrite is enable on your apache setup.
2) add <VirtualHost *:80>
DocumentRoot "/path/to/your/htdocs/bonfire/public"
ServerName bonfire.dev
ServerAlias bonfire.dev
<Directory "/path/to/your/htdocs/bonfire/public/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3) edit your /etc/hosts file, add this line 127.0.0.1 Bonfire.Root
4) restart your apache
5) access bonfire on http://bonfire.dev, instead of http://localhost/Bonfire_Root/public
hope it helps
I would suggest no need to use htaccess if you are working on local environment.about your error when you click on install button after that in your url put your project folder name like 'host:port/yourprojectname/public/index.php' . would redirect to you next page to get installation process done.
I had same problem but in windows yes working on mac and windows quite similar. When i clicked on install it goes to http//localhost/public which is not correct url so i have change by adding my project name after localhost http//localhost/project/public/index.php.
Major difference between mac and window while using PHP is s you have to use ip address in place of localhost.
Assuming you are installing bonfire in windows D:\ drive and path of you index.php is "D:/xampp/htdocs/bonfire" please follow below steps:
1. Edit your `D:/xampp/htdocs/bonfire/index.php` file
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/xampp/htdocs/bonfire"
ServerName 127.0.0.1
ServerAlias bonfire.dev
</VirtualHost>
Open your httpd.conf file (in case of xampp path will be D:\xampp\apache\conf\httpd.conf) and add this in the end of your file.
NameVirtualHost localhost
<VirtualHost localhost>
DocumentRoot D:/xampp/htdocs/bonfire
ServerName localhost
<VirtualHost>
#####
## myproject.dev
## DOMAIN of myproject
#####
NameVirtualHost bonfire.dev
<VirtualHost bonfire.dev>
DocumentRoot D:/xampp/htdocs/bonfire/public
ServerName bonfire.dev
</VirtualHost>
note that bonfire.dev is a naming convention i have given to my website and mentioned it inside my C:\Windows\System32\drivers\etc\hosts file so as convenient to you, choose any name suitable to you
Edit C:\Windows\System32\drivers\etc\hosts file.
Add below lines in hosts file.
127.0.0.1 localhost
::1 localhost
127.0.0.1 bonfire.dev
4. Restart Apache and now open your web page `http://bonfire.dev/`
This solution works 100%, I have been fighting up with same issue and now finally its fixed. Just try it and get back to me in case of any issue.
launches the PHP server into the directory of your project exempel
www / (project) / public / php -S localhost: (port)