cakephp css and images problem at localhost - cakephp

I've downloaded a project from a root server. It acts there very fine. But when i run the project in the localhost on xampp environment, didn't find the any css nor any images. How can i solve this problem?

You should also verify the contents of your .htaccess files in the root install directory, in /app and /app/webroot. Depending if you are serving CakePHP from a subdirectory (like http://domain.com/somesubdirectory/) you might have to add a RewriteBase directive to your .htaccess file in /app/webroot/. Details here.

Check the permissions of the /app/webroot/css and /app/webroot/img folders. Also check if you have mod_rewrite properly configured.

Check out this tutorial which talks about mod_rewrite:
link text
"Occasionally a new user will run in to mod_rewrite issues, so I'll mention them marginally here. If the CakePHP welcome page looks a little funny (no images or css styles), it probably means mod_rewrite isn't functioning on your system. Here are some tips to help get you up and running: ..."

Related

PimCore X Not Loading

I've been following the guide found here, https://unixcop.com/how-to-install-pimcore-on-ubuntu-20-04/, to install the PimCore X version from scratch on a fresh server.
However, after going through all of the steps and firing up the initial home page, I get the profiler complaining about a number of 404 errors for resources that it cannot find within the /_wdt/ folder, with the profiler never loading.
The admin section of PimCore cannot be loaded either, it comes up with a big 404 error, so I'm guessing that the router isn't working properly. Looking into the log files for both PimCore and Apache, there isn't anything useful to be found.
I've tried to install PimCore several times, each with the same result.
Any help would be gratefully received.
It turns out that the .htaccess file within the /public/ folder wasn't being installed with the fresh install. The .htaccess file contents can be found here, https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Apache_Configuration.html
Best way to install Pimcore are using docker.
You can read it on github page https://github.com/pimcore/skeleton
All that you need is install docker.
You can do it from this link https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

Exotic filetypes not loading after build in react

i created a create-react-app and want to use filetypes like webp or mp3.
When i run my application on localhost via npm run start everything works fine, but after my deployment on my server (which uses npm run build and delivers the build folder) it doesn't load filetypes like mp3 or webp anymore. Why is this happening? i think its any simple configuration in react or anything like that, but i cant solve this problem by my own. Thanks for your help.
The issue may be with typescript (if that is what you're using). Typescript will convert .ts and .tsx files to .js, but not move most other files over to build. If they are in a separate assets directory, you have to ensure that gets deployed too. If this is the issue, you have a few choices.
You can manually move the files over to build as a 'post' deploy step (using say, a shell script).
You can use a bundler like webpack to help you maintain the references to those other assets and bundle them correctly.
I finally found the problem that caused this behaviour. Amazon AWS Amplify creates a rewrite rule for single page applications (SPA). You can find this setting under Rewrites and redirects in your Amplify application settings. There you will find a rewrite rule with following source address:
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>
...change it to...
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json|mp3)$)([^.]+$)/>
... for example, to allow mp3 files. This is also important to allow webp-Images or woff2-Fonts.

Cakephp installation on WAMP missing files

I am running WAMP and it runs correctly. I installed composer apparently successfully, and also installed Cake with no errors. It created a cquiz project. When I go to the URL in my browser I see all of the text for the default cake page, but none of the css or images. It is looking for files, for example, /cquiz/css/cake.css but when I open the cquiz directory I don't see any folder called css. What did I do wrong?
You need to set your documento root to cquiz/webroot.
If you are using Apache (I assume this because you said you are using WAMP) you have to edit the httpd.conf file and change the document root to your webroot directory.
Otherwise if you cannot or don't want to change the document root (let's say for example if you have another web app in the same server) you can move all the files inside webroot to your root directory and edit the index.php (which you moved from webroot to root directory) and change the require webroot to fit the new location.

ERR_TOO_MANY_REDIRECTS after moving CakePHP project from a dedicated server to another dedicated server

I'm new to CakePHP and my employer asked me to move our CakePHP app from a dedicated server to another server (for testing purposes). I've copied all the files, changed app's database.php config but I'm getting a ERR_TOO_MANY_REDIRECTS when accessing the app on the new server.
I did not work on the app so I don't know much about it, but I have all the files.
LE: So, I've uploaded the app on a fresh install of CakePHP. I now have 3 .htaccess files, CakePHP says it's working, but when I try to upload DebugKit (following the install notes & having the proper version for CakePHP 2.4.3.) I get the ERR_TOO_MANY_REDIRECTS.
A look in Chrome's console shows me this. If I delete the DebugKit altogether, the page looks like this & it also has the footer from the app.
The new structure of the app is the standard one.
Please advise!
Best guess is the (apache?) DocumentRoot setting may be clashing with your APP config on the new server and/or the PHP settings. Have you checked your php.ini on the new server? What's the output of phpinfo() ? Once fixed HIGHLY RECOMMEND check other environment variables by turning on the DEBUG flag in config/app.php For your version try pr(Debugger::trace()); or even better for dev. install the Debug kit. Anyway, DocumentRoot should be set to webroot (assuming default install and directory structure).

Cake php css load issue on apache2

My css file is not loading.
I have just installed apache2 with php on ubuntu. (Mysql server already installed.)
I have placed fresh download of cake php from official site. But when I am trying to access it, CSS file is not loaded.
Here is the screen shot.
I would think telling him to read the instructions and setup requirements including the use of mod_rewrite would be a better solution than pointing him towards the no mod_rewrite method.
A quick google for mod_rewrite apache ubuntu brings up a ton of possibly useful information and will likely work out for him better than turning off one of Cake's key features.
Try deleting these files:
/.htaccess
/app/.htaccess
/app/webroot/.htaccess
and uncommenting this line on app/config/core.php [69]
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
EDIT:
to answer your comment: as far as I know, what this does is set the base url of the app to index.php (env() Gets an environment variable from available sources) That baseUrl is used to rewrite the urls without using mod_rewitte, with pathinfo.
I've seen this issue when the .htaccess is missing from the root or from webroot. Usually, this occurs when adding files to svn and the .htaccess is not included.
Just wanted to add
to enable mod_rewrite with apache on ubuntu
sudo a2enmod rewrite

Resources