So for context, the application is a portal for my company that we have hosted on the main production server. Then we have the developer version on a different server. Same exact application but on a different VM and has a different url. That was all set up before I got put in charge of it. Now we want to make an alpha server as the dev server can affect the main database. So for the alpha we need to pretty much have it be exactly like dev, but once it's built, copy the database to a separate db and disconnect it from the main one.
But right now the issue is setting it up. I got Apache2 setup and the site all put together. Now the issue I'm running into is that it's showing the site but not running any of the CSS or JS. The laravel log shows this:
[2019-02-20 11:33:51] local.ERROR: User: test Route:
https://test/app/portal/final.css File:
/var/www/laravel/bootstrap/cache/compiled.php Line: 8335
Class:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Exception: exception
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in
/var/www/laravel/bootstrap/cache/compiled.php:8335
The same error comes up for the js file but I don't want to post that as it is the exact same error.
And the output of my site right now is just a bunch of links and text in a left tabbed column on the left.
I assume this is due to something not being installed or a config file not reading properly. The code for the site is all just git fetched so it's exactly the same as from the other two servers. The only difference is packages installed into the actual server. It seems that the css and js files aren't loading for some reason. I tried a bunch of other threads and fixes with no luck.
PHP Version is PHP 5.6.40-1+ubuntu18.04.1+deb.sury.org+1 (cli)
Apache2 for the server.
Composer version 1.5.6
Laravel 5
Thank you for any help.
Apache Config: https://drive.google.com/open?id=1im9voo0xqlyuf48gX-JJsRu00f0ym1UX
The CSS and JS files are in the public folder under css and js folders respectively.
Like I said, everything works just fine on the two servers already in place and the filesystem and code is the exact same at this point. The only thing that can be different is apache, laravel, and php.
Are you using Laravel mix with version ? If so, you need to import the css like :
<link rel="stylesheet" src="{{mix('final.css')}}">
or use the asset function just to be safe for any CSS/JS you need to import.
Three possibilities...
Apache root folder
First, the document root in your apache config (or site-enabled) needs to be the /public folder. In which case your request wouldn't hit the .htaccess and redirect to index.php and you'd get a bad route error. So this is a less likely option.
Compile Your .css and .js
You haven't compiled the .css and .js using Webpack (or gulp or whatever if you don't webpack) on the new server. In this case, the .htacess would send the request to index.php and Laravel would look for a route (which is what your error looks like) and then you'd get an error about an invalid route. Note the .css and .js should be in the .gitignore if you use git to clone the project, making this an easy thing to overlook and to have happen. Nice thing is that if node and npm are setup and you use webpack, it should just be a:
npm run development
The sad thing is getting node and npm and webpack all working isn't always as simple as it should because of versions and such.
Missing or not reading the .htaccess
Finally, your .htaccess isn't being read or didn't get copied over, which would mean that that / route would magically work, but any other routes wouldn't... Though, in that case your .css and .js should still work -- but not likely.
Related
I've got a legacy PHP project to fix a thing or two. I've downloaded it via FileZilla and served it on my local machine with a local copy of the database. The project is exactly the same with the live one, yet the live one can open the url/contact.html but on my machine it says no such file is found. All other pages go for url/categories/ or url/products/ so I've tried altering the url but no use.
All the other pages within the site are simple: one .php controller one .php model and one .tpl smarty template view. Requiring no .html at all. But this one is somehow different. The .htaccess file is exactly the same as the live version. I've tried adding a rewrite rule to direct every .html to .php but didn't work. I'm lost and out of options, please help? It doesn't even have to be an answer,"Try looking into that" would work too.
I'm working via XAMPP on windows, and I've configured the https:// to http:// on my project but that's all. Even hidden files are checked and confirmed.
have checked that contact.html is a static file (like a real existing html file?)
is there some kind of "routing" within the PHP of the project? If there is route urls might be really anyware.. in the mysql database, redis, a json file and whatnot.. have seen them all.
try to debug where and how it works on the "production" server by using some logging to a file edit the file through filezilla and log to a 'mylog.log' file until you find out what is going on.. or if the site is not used all the time by clients - you can just try to echo stuff to figure out how this exact /contact.html works
Something wrong with my assets configuration, it looks to /usr/lib/cgi-bin/assets, which is wrong I guess. How to fix it?
Yii setup is initial.
Apache config:
Nginx config:
I recently also had similar problem with missing folder assets (I don't know how that happened since I have installed Yii2 multiple times and that occurred just once). The difference was only different path to it.
What solved my issue is creation of that folder in specified path (which is /usr/lib/cgi-bin in your case and it should be an empty folder, no need to write anything in it).
After that, Yii2 system should generate all widgets' JavaScript and CSS files automatically (assuming your server allows that). Try to access the website and if you still have the same issue (which shouldn't be the case anymore?), check if there are any files/folders in your newly created assets folder.
It took me all day to find what is happening; however, I found nothing.I am using Dreamweaver CS6. I want to set up a local Apache testing server as to run .php files. I did that. I 've followed the instructions given by Adobe, correctly. Everything is OK with the testing server since my .php files are running. The problem I cannot solve is the following: My main file index.php does not recognize any changes in any external .css file which of course is declared inside the head section. For example,
<link href="mycss/pb.css" rel="stylesheet" type="text/css">
where mycss is a folder inside htdocs/tester/ and tester is the folder inside which there are all the site files. There is no error in any path; in case I remove the Apache server everything works fine. There is no error in paths in Dreamweaver Apache setup:
Server Name: Local Apache
Connect using: Local/Network
Server Folder:C:\xampp\htdocs\tester
Web URL: //localhost/tester/
(with http: in the beginning)
However, any change made in pb.css is ignored by index.php!! This is crazy... I suspect this is a matter of php.ini, .htaccess, httpd.conf, I do not know what. I'd appreciate your help.
Thank you very much
Make sure the file is in the correct path.
Also press ctrl+F5 to refresh and clear the cache. Because the css file is stored in the cache of the browser so you don't have to download it each time. It just loads it then.
I can find dozens of articles on installing CakePHP in a sub-directory and getting it to appear in the root url. That is NOT what I am asking for. I rarely down-vote, but if you give that answer, I will down vote you.
I have CakePHP in my root directory on my hosting server. It's a clean Apache server instance... I think. I'm really not a server guy. I created a new account through WHM on Hostgator and have CakePHP sitting in the public_html.
However, there is no domain name associated with this server yet. The URL is like this:
http://123.456.0.0/~example/
And CakePHP gives me the following errors:
Error: ~exampleController could not be found.
Error: Create the class ~exampleController below in file:
app/Controller/~exampleController.php
I imagine there's some .htaccess configuration that makes it ignore that /~example in the URL. Can someone point me in the right direction, even if it's just the right page in the CakePHP docs?
By partially following the advice at http://bakery.cakephp.org/articles/syl-via/2011/09/19/rewritebase_config_for_cake_installation_with_userdir_and_mod_rewrite I was able to make this work by adding the following to the .htaccess file in the root of the Cake install:
RewriteBase /~example
I put this after RewriteEngine on for it to work.
In other words, if your Cake install is at /home/example/ then it's the /home/example/.htaccess file that you'd change.
I didn't edit app/.htaccess or app/webroot/.htaccess because it seems to work without these files needing to be edited.
Please note that I tested this with the latest version of Cake (2.3.5) -- I don't know if it will work the same way in older versions.
I have a shared hosting account in which I want to install my symfony 1.4 and deploy and application. I bumped into some issues because of the inability to change the apache config on the production server.
the structure of my web server is:
hosting_account_name
html <--- public folder
I then moved all files in symfony local app folder to my hosting_account_name and put the web folder content in html
So i got the following structure:
hosting_account_name
apps
cache
config
data
html
css
js
index.php
.htaccess
frontend_dev.php
lib
log
plugins
test
and i added the line bellow to config/ProjectConfiguration.class.php
$this->setWebDir($this->getRootDir().'/www');
I have a couple of issues though:
1. when i access the frontend_dev.php no images are due to the fact that symfony expects some files to be under a sf/ folder. Should I move the files there?
2. Index.php gives an error. Even with display errors set to yes and 500 internal server error is presented.
Also i had to set my permissions to 777 on cache and log. Their are under the folder html so that's ok for security right?
First, you said that the "public" folder is html, but you used $this->setWebDir($this->getRootDir().'/www');. Is it html or www? (Just to make sure)
Then: setting the sf_web_dir should work like you expected, so that shouldn't throw any errors.
To link the /sf Symfony folder, you will need to add something to your apache configuration. As described on the first page of the Jobeet tutorial, you will need to add an Alias to the /lib/vendor/symfony/data/web/sf.
If you don't have access to the httpd.conf, you could also add this to your .htaccess.
777 for log and cache is ok. It's what the default project:permissions task does as well.