Laravel not good work on localhost - php

I have a code (who works on remote server), but he don't want work on my VM linux (ubuntu 16).
Issues are varied :
CSS isn't read
#import and #expand don't work
Laravel routes don't work
Apache 2 rewrite_module is ok (classical solve for Laravel routes issue)
PHP 7 is ok (phpinfo is good), Laravel is ok (access to database via Eloquent is good).
I precise that my html code is generate via php artisan with blade.
I suppose that I forgot a step in my configuration but I don't see what...
Edit :
Change on Apache's config DocumentRoot from root of application to /public solve the CSS issue.
a valid .htaccess is now ok, without change.
So, now, my major issue is to find why
https://www.xxxxx.vvv/api/v3/docs works and https://localhost/api/v3/docs doesn't.
Given that https//www.xxxxx.vvv/ and http://localhost/ work in the same way.
versions : php 7.0.3
Laravel 5.0.4
(and I don't want update)

As you said, .htaccess file missed. So put it in public directory with the following code:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Related

How to replicate MAMP configuration to Ubuntu server

I'm having an annoying problem, i've developed a MVC php application, which of course uses a lot of redirects by controllers to controllers and so on.
Well, here's the issue.
On my MACs (note that i'm using a plural) works fine. Different versions of OSX, same version of MAMP on each one, same configuration of MAMP on each one. Even on the macBook Pro of the my office colleague it works fine with MAMP.
But when i move my application on a ubuntu server it causes a REDIRECT LOOP
between the login controller and the home.
After various experiments i think that the problem is the different configuration from MAMP to UBUNTU.
On MAMP i'm using the php 5.6.10 Version, enabled mod Rewrite (i use .htaccess to rewrite the url). Well, i would like to try to move my MAMP config to the ubuntu server. But i don't know how.
In MAMP i have 2 possible directories where the php.ini is located.
1) bin/php/php5.6.10/conf/php.ini
2) conf/php5.6.10/php.ini
Both of them are edited at the same way. I also think that the problem is inside the Apache2 config and not inside the PHP config, but i'm not 100% sure.
Keep in mind that i'm not very familiar with the htaccess files, so the rules inside my htaccess comes from a codecourse tutorial. But however on MAC it works...
However, here's the .haccess file that handles the URL rewrite:
Options -MultiViews
RewriteEngine On
RewriteBase /astrid/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
AddType 'text/css; charset=UTF-8' css
Also if you want to take a look to the project code here's the git repository:
Astrid
I'm stuck and i don't know how to figure this out! D: Any kind of help is extremely appreciated! Thank ya'll!

Using Codeigniter application on freeBSD system

I have freeBSD installed on IBM server. There is also apache, php and mysql installed on the server. A PHP application running on this machine is working just fine, but our new version of the same application developed in Codeigniter gives a "Page Not Found" error.
The thing is the application is accessible and runs well (only the non-english character are displayed not well) if the index.php is included in the url.
I have modified the file .htaccess to remove the index.php from the url, I kind of need to use the .htaccess in the application's root directory. This (using .htaccess) is actually causing the error.
Please let me know what configuration do I need to do.
Edit:
Bellow is the content of .htaccess in the root directory of the application:
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteRule ^(.*)$ /football/index.php/$1 [L]

Symfony2 remove web from the url on the external server

I've been looking for the solution for a long time. There are a lot of such topics and I know it. But I still can't figure it out. How can I remove web from the symfony2 project url? I tried to do this with htaccess looking like this:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [L]
but it doesn't work. It gives me an error:
No route found for "GET /web/"
I really can't change the root directory on this server as only thing I have is FTP permission. Anybody has any idea for this?
Edit: I also tried a trick to put all the files from web in root directory and the rest of the project higher. The problem is the highest directory I have access to is the root.
You shall need to update your virtual host config file and set the DocumentRoot to point to the web folder.
For example you may currently have it set as
DocumentRoot /var/www/myproject/
but you need to update it to
DocumentRoot /var/www/myproject/web
More information can be found within the Symfony2 cookbook here
Also this shall stop anyone trying to access the config/parameters.yml

Laravel 4 on PHP built-in web server (CGI) instead of Apache

I am trying to run laravel4 on a service that cannot use Apache or nginx.
everything is good till I wanted to use Routes on my project.
I've tried using /index.php/... on the URL but could not make this work.
is there any way to force laravel not to use .htaccess file or any ways to use raw PHP routing?
Try setting the "application.url" option in one of configuration files, probably in app/config/application.php or application/config/application.php:
https://github.com/laravel/laravel/blob/4cb904f44d24f856ec9c1040d2198ed8f009723b/application/config/application.php
Set it to http://127.0.0.1:54007/index.php. Now when laravel creates url it will use this as a root and the final urls should be like http://127.0.0.1:54007/index.php/account/signin.
Also you need to modify PHP Desktop settings so that it uses a fixed port. Edit settings.json file and set it like this:
"web_server": {
"listen_on": ["127.0.0.1", 54007],
In laravel's .htaccess I've found this:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
So it should work fine to add "/index.php" to root url, because this is what apache's mod_rewrite does.
If something doesn't work, take a look at some other files named "url.php", "uri.php".
Let us know if that works.
EDIT.
You may also try setting root url to "index.php", without the "http://". This way it wouldn't be required to set a fixed web server port.
UPDATE
There was a bug in Mongoose web server in PHP Desktop, that prevented urls like "index.php/company/5" from working properly. See the __fix_mongoose_env_variables() php function in Issue 137 that fixes it:
https://code.google.com/p/phpdesktop/issues/detail?id=137

Path not found error in Zend Framework

I have been getting this error in Zend framework when i want to run the static content , The error is like
///Not Found
The requested URL /public/content/services was not found on this server.
Apache/2.2.20 (Ubuntu) Server at localhost Port 8090///
This is occuring when I try to access localhost:8090/content/services
Please give me a solution , thanks in advance :)
I Replaced "AllowOverride None " with "AllowOverride FileInfo " in httpd.conf file and it worked !!!
make sure you create the route in your application.ini as specified on page 39 "Defining Custom Routes"
//this needs to be exact
resources.router.routes.static-content.route = /content/:page
resources.router.routes.static-content.defaults.module = default
resources.router.routes.static-content.defaults.controller = static-content
resources.router.routes.static-content.defaults.action = display
without the route being defined correctly the static content will not work as suggested by this book.
i/f you are going to use this book "Zend Framework: A Beginner’s Guide" follow the code as close as you can until you understand it. ZF1 is not trivial to understand.
Don't change your .htaccess arbitrarily, keep it as close to stock as possible. It's ok to use it to set the environment and that's about it. Zf1 won't work correctly if the .htaccess is even a little incorrect.
//stock .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I noticed you are using Ubuntu... Make sure you have the correct permissions and ownership of the files in your document root. Ubuntu has some different default settings for file permissions.
The book also instructs you to establish a vhost for your site ( page 13 "Define Virtual Host Settings" ). Please execute this recommendation it will make your life easier as you learn this framework.

Categories