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)
Related
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 am pretty new in PHP and moreover in Laravel and I am pretty desperate trying to deploy a Laravel 5.4 application that works fine on my local environment on my Linux remote server.
So I think that it is something related to virtual host configuration or something like this (maybe also something related to the .htaccess file)
In my local environment (I am using XAMPP on Windows) I have setted this virtual host into the C:\xampp\apache\conf\extra\httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/HotelRegistration/public"
ServerName laravel.dev
</VirtualHost>
So opening the laravel.dev URL I obtain the standard Laravel homepage (I have yet not replaced it with a landing page).
Then if I open this URL: http://laravel.dev/registration
I obtain the user registration page developed by me, this because I have this route into my web.php file into my project:
Route::resource('/registration', 'RegistrationController');
Then into my RegistrationController.php there is this method showing the resources/views/registration/index.blade.php view
public function index(){
return view('/registration/index');
}
All works fine.
Now I have uploaded this Laravel website into my remote Linux server, into this folder: /var/www/html/HotelRegistration
But now my problem is that in this remote environment I have not virtual host (correct me if I am doing wrong assertion: from what I have understand the virtual host is used on the local environment to simulate a domain that Laravel need to point to the public folder, is it this reasoning correct?)
Anyway, this is the URL of the public folder of my deployed web site on my remote server:
http://89.36.211.48/HotelRegistration/public/
As you can see opening it the Laravel landing page is correctly shown, the problem is that I can access to the previous registration page, the only way that I have found is to open this URL:
http://89.36.211.48/HotelRegistration/public/index.php/registration
but it is pretty horrible and above all when the registration form is submitted it is generated a POST request toward this URL http://89.36.211.48/registration that end into a 404 Not Found error.
So I think that it depend by the fact that in this remote server I can't use a virtual host that simulate a domain (as I have on my local environment), but I am not sure about it.
What can I do to solve the situation? Do you think that using a effective domain (something like: www.myregistration.com) that points to this directory of my remote server http://89.36.211.48/HotelRegistration/public/ I can solve this problem?
You need to configure your domain in your server and need to reconfigure the apache. I'm considering you are having apache2 server so here you can do:
Step 1 Go to the apache2 folder cd /etc/apache2
Step 2 You can see sites-available folder go inside it cd sites-available
Step 3 Make a new file name it laravel.dev.conf
Step 4 Write down the following sudo nano laravel.dev.conf
Step 5 Write down the following option:
<VirtualHost *:80>
ServerAdmin webmaster#laravel.dev
ServerName laravel.dev
ServerAlias www.laravel.dev
DocumentRoot /var/www/html/laravel.dev/public/
ErrorLog /var/www/html/laravel.dev/logs/error.log
CustomLog /var/www/html/laravel.dev/logs/access.log combined
<Directory /var/www/html/laravel.dev/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
Step 6 Now go to this folder/create a new one cd /var/www/html/laravel.dev
Step 7 Copy/Install your laravel application here.
Step 8 Now you can enable your site by typing sudo a2ensite laravel.dev.conf
Step 9 Now restart the apache2 sudo service apache2 restart
Now you can have proper access to your domain. Hope this helps.
Since you are using XAMPP
Add the following into your VirtualHost Directive:
<Directory "LINUX PATH TO /HotelRegistration/public">
AllowOverride All
</Directory>
Your final VirtualHost Directive should look like:
<VirtualHost *:80>
DocumentRoot "LINUX PATH TO /HotelRegistration/public"
ServerName 89.36.211.48
<Directory "LINUX PATH TO /HotelRegistration/public">
AllowOverride All
</Directory>
</VirtualHost>
After the configuration changes, restart Apache then you are good to go.
I have Laravel project and can run it with
php artisan serve
I am executing this command inside D:\Users\Dims\Design\MyApplication directory. After that I can see site on http://localhost:8000 and can navigate it, although slow.
Now I am configuring the same place to serve by apache:
<VirtualHost *:80>
ServerAdmin webmaster#myapplication.app
DocumentRoot "D:\Users\Dims\Design\MyApplication\public"
ServerName myapplication.app
ErrorLog "logs/myapplication-error.log"
CustomLog "logs/myapplication-access.log" common
<Directory />
AllowOverride none
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>
Not, that I pointed application not to the root of the project, but to the public directory. This makes me able to open home page of the site, but clicking any links causes error 404.
If I serve
DocumentRoot "D:\Users\Dims\Design\MyApplication"
with Apache, I am unable to see home page at all, saying 403 forbidden. This probably because this directory has no index.php.
So, is it possible to serve Laravel project with Apache?
Yes, it's absolutely possible to serve Laravel applications with Apache. To debug why your links are producing 404 errors, you'll have to provide more information about the URLs these links point to. It's best to always use Laravel's url(), secure_url() or route() helper functions when printing URLs. Also confirm that the Apache module mod_rewrite is enabled (Laravel Installation: Web Server Configuration)
Set up the apache server host file as shown below:
<VirtualHost *:80>
ServerAdmin user#email.com
DocumentRoot D:\Users\Dims\Design\MyApplication\public
ServerName exampledomain.com
ServerAlias www.exampledomain.com
ErrorLog "C:/some_dir/example.error.log"
CustomLog "C:/some_dir/example.access.log" combined
<Directory "D:\Users\Dims\Design\MyApplication\public">
Options -Indexes
DirectoryIndex index.php index.html
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now that you have set the server name to exampledomain.com you also need to set up the hosts(DNS) file in windows so that you can type in exampledomain.com in your browser and access your laravel project.
Editing the hosts file:
Please follow the steps below:
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as
administrator.
From Notepad, open the following file:
c:\Windows\System32\Drivers\etc\hosts
Make the following changes to the file.
At the end of the file add the following line:
127.0.0.1 exampledomain.com www.exampledomain.com
Click File > Save to save your changes.
What we did here was to tell windows that when we try to access exampledomain.com or www.exampledomain.com do not try to find the server over the internet but take the request to the local machine itself(127.0.0.1) which will in return serve your laravel project.
You can also find one another method here at wikihow -> http://www.wikihow.com/Install-Laravel-Framework-in-Windows
If after configuring the virtualhost you're still unable visit your laravel app, but it works fine with artisan serve, check your apache php version:
Check /etc/apache2/mods-enabled and if the php module is lower than the one required in laravel specifications, update it. In my case:
$ a2dismod php7.0
$ a2enmod php7.2
$ service apache2 reload
Solution found at: https://laracasts.com/discuss/channels/laravel/unexpected-illuminatesupportarrphp-on-line-388
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 working with an existing PHP web application. It's running fine on the remote Linux server but I can't run it on WAMP server, Windows 7 on my local computer. The problem is the previous developer's used absolute path all over the code. for example one of them is:
require '/disk2/html/src/web_tool/db_connect.php';
my localhost folder is F:\wamp\www and I have the same structure:
F:\wamp\www\myProject\disk2\html\src\web_tool\db_connect.php
But it can't find the db_connect.php. I can't change the path because it's a big project and if I want to, I have to find and change more than 400 line of code. I'm not sure what the problem is and how to make it work. Any suggestion is highly appreciated.
EDIT: I ran a simple test on my WAMP Server. I created this file structure:
F:\wamp\www\test\myfolder\index.php with this code:
require '/myinc.php';
and F:\wamp\www\test\myinc.php with this code:
echo 'It works!';
I get this warning:
Warning: require(/myinc.php): failed to open stream: No such file or directory in F:\wamp\www\test\myfolder\index.php on line 2
and this error:
Fatal error: require(): Failed opening required '/myinc.php' (include_path='.;C:\php\pear') in F:\wamp\www\test\myfolder\index.php on line 2
I don't have such a folder as C:\php\pear on my disk.
The WAMP server is just installed, haven't touched anything in the php.ini or other config files. the version is:
WAMP SERVER 64bit version 2.5 including:
Apache : 2.4.9 MySQL : 5.6.17 PHP : 5.5.12 PHPMyAdmin : 4.1.14 SqlBuddy : 1.3.3 XDebug : 2.2.5
I think your best solution would be to move the site source and create a Virtual Host, then the absolute paths would work and you can address the site properly as well.
First move the disk2 folder and all its subfolders to the root of your F: drive.
F:\disk2.....
Then create a Virtual Host to describe its new location.
Edit \wamp\bin\apache\apache2.x.y\conf\extra\httpd-vhosts.conf
If this is your first Virtual Host definition, remove the existing contents of this file.
I have assumed that F:\disk2\html is the correct folder to become your DocumentRoot.
Add this to the file
<IfDefine !APACHE24>
NameVirtualHost *:80
</IfDefine>
## so the the wamp menu page loads
<VirtualHost *:80>
DocumentRoot "F:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "F:/wamp/www">
AllowOverride All
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</IfDefine>
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "F:/disk2/html"
ServerName example.dev
ServerAlias www.example.dev
<Directory "F:/disk2/html">
AllowOverride All
<IfDefine APACHE24>
Require local
</IfDefine>
<IfDefine !APACHE24>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 localhost ::1
</IfDefine>
</Directory>
</VirtualHost>
Save this file.
Edit httpd.conf and remove the comment from this line
#Include conf/extra/httpd-vhosts.conf
remove the # in col 1 and save that file.
Now edit the hosts file C:\windows\system32\drivers\etc\hosts and add these lines.
127.0.0.1 example.dev
::1 example.dev
This is a windows protected file so you will have to open your editor using the "Run as Administrator" or you wont be allowed to save your changes.
Now start a command windows also using the "Run as Administrator" and execute these 2 statements to refresh the DNS cache with your changes to the hosts file.
net stop dnscache
net start dnscache
Now restart Apache so that it picks up your configuration changes, and you should be able to use this address in the browsers address bar.
example.dev
The DocumentRoot should be as it was on the live server and the absolute paths used in the PHP code should also now work as they do on the live server.
Change example.dev to whatever makes sense as related to your live sites domain name.
If you have the same folder strcture a simple set_include_path() should solve the problem in the root directory.
I gues in F:\wamp\www\myProject there should be an index file, just add there:
set_include_path('');
But if you can't find the file you're looking for, I guess that it is missing / you did not copy over everything you needed (something like that). Than the problem is not really the relative path.
This isn't much of a technical answer and it's five years later, but FWIW I had the same issue after upgrading my WAMP version after a couple of years that some of by requires were no longer working on the localhost while they were working just fine when published on the active webapp.
For me, I found a setting called 'allow_url_include' and activating that setting and restarting services everything appears to be in working order now. Hope this helps somebody.