CakePHP 3.8 on 000webhost

Hi,

I have created Website using CakePHP.
When I uploaded that in my 000webhost server some image and css files are not loading?
Please help on this?

I think you need to configure virtualhost in httpd.conf with “AllowOverride All”.

Somewhat off-topic but I do want to mention to not use 000webhost or a .tk for anything outside of “playgound” purposes (not recommended for somewhat serious development and definitely not production).

I’m sorry in advance if this stuff is not allowed here on the Discourse but I feel like it’s my duty to make people aware of dodgy webhosts n stuff

I’m using 000webhost there I can’t edit httpd.conf.

Why you are saying like that?
What is wrong with 000webhost and .tk domain?

000webhost

000webhost tends to get knocked offline pretty often and depending on the app, the limitation of 10GB bandwidth a month (or 100GB for their “normal” paid package) is really low.
10GB might seem like a lot at first but taking my own website as an example, that only gets you an average of 7400 visitors (my website uses 1.35MB per visit on average, excluding bigger assets like high-res images)…
That might again seem like a lot but again, depending on the app, this might not be a lot (again, taking my website as an example, I use about 80GB of data a week… and my website is fairly small).
Though since you are using CloudFlare, the bandwidth used might decrease if you setup proper caching.
Then there is the additional thing where they have had some really bad security (not using SSL for anything and storing passwords in plain-text are the best knows).
There is not much inventive for a free hosting provider to actually deliver something good.
And finally something that goes for about every webhost with CakePHP: they often don’t allow access to a CLI so doing stuff like running migrations (or rolling them back if need be) can be a huge pain in the buttocks.
Also, the “powered by 000webhost” thing in the bottom isn’t very professional.

My recommendation: use a more established web host like ovh.com, which will cost you like 2 euros a month

.tk

As for .tk, it’s not a good thing for your website when it comes to getting (and keeping) customers.
The rules of .tk state that you need to have:

  • a regular amount of traffic coming in to your site (so you need to keep your visitors coming back)
  • the site is nearly always online (so goodluck if your site dies, beit the webhost having a brainfart or your app having a bug)

Failure to do the afore mentioned means your website will get replaced by an advertisement page…
this will turn away potential customers really hard, and no warning will be given about this.
So let’s say you are going on a holiday with your family and you don’t have much visitors during that site, you might come home with a nasty surprise…
I have seen cases where a site using .tk was getting really popular (by means of hard work of the site owner) just for it to be sold off to someone else the next day.

On top of that, the SEO score for a .tkis really hard to get up since a big part of the SEO score is the age of a domain.
But since you might (temporarily) lose access to a .tk domain at any given moment, the counter might keep resetting.
And of course, .tk is generally associated with scams.

My recommendation: Invest in a proper domain. This might set you back a bit more (I pay 5 euros a year or so for finlaydag33k.nl) but is a well worth investment.

Final sayings

While what I said is very generalized and accuracy might change over time I do want to stress that you’re often off better investing a bit of money into getting something proper.
I used 000webhost and .tk for a long time myself but wasn’t very fond of it since I kept getting issues all over the place.

Additionally, about all reputable webhosts allow you to use their mailservers (with your domain attached to it) so that also sweetens the deal since now you don’t need to have a gmail account for your business stuff, which makes it look more professional.

I’d say that investing like 50 euros a year (yes, 50 euros a year) is well worth the reduction in risk and gains in professionalism.

In The Netherlands, we have a saying for this: “goedkoop is duurkoop”, which roughly translates to “cheap is expensive”.
Since, while you may not pay a lot (if anything at all), you often pay in another way (in this case, you pay by your hard work and name/brand suddenly going lost).

Thanks for your explanation.
I’m using this for study purpose.
I will try your suggestion when I need it really.

For study purposes I’d use something local like WAMPP, XAMPP or, if you want to do it fancy Docker.
For the last one, I have made a tool called Glaze which can help you with using CakePHP in Docker, though it contain bugs :slight_smile:

Why do I say this?
Because having your site public for “study” purposes can cause some issues when it comes to security.
Let’s say you forget to santize your input in some spaces.
Great, now your site might be gone (or worse, spreading malware).

With local development, only you can reach your site (or maybe some prankster colleague).
It also has the added benefit of being able to do some work when your internet is down.
You can also use Git nicely to keep track of your changes, go back if needed or work on multiple things at the same time (eg. if you get stuck working on feature A you can continue on feature B).

When I move work, I use a local environment on my workstation or laptop (this is also where Git helps you nicely) to develop something new (or update something or fix bugs), push it to git, run a pipeline which will build, test and package my app, then it deploys to my testing server (which I can just nuke and re-deploy if need be without much effort from my part) and if I’m satisfied with the result, I can tag it and it gets deployed to my live server.

There is just so much stuff you can easily use when doing development on your local machine instead of directly on your webhost that will make development a breeze.
Things like:

  • CI/CD
  • Git
  • Sass (A CSS Pre-compiler)
  • Easy installation and updates of additional packages
  • Easy updates of CakePHP itself
  • Working offline
  • many, many more

Still, I haven’t got any solution for my question.

Taking a look at your failing files, looks like you’re script/link tags are wrong.

You are refering to https://www.akogulan.tk/css/selectize/selectize.default.css, but the file is actually at https://www.akogulan.tk/bulkmail/css/selectize/selectize.default.css

It was work properly on localhost/bulkmail.
When I put that on 000webhost then only it is failing.
CakePHP 2.x allow me to correct error like this by editing.htaccess by inserting RewriteBase /bulkmail
but in CakePHP 3.x that is not working.

How are you including/loading that css file verses the ones that are working? The fact that some work, and some fail makes me thing it’s a typo in the code.

As I found those files are called by jscript and css those already included

Files that are missing are found at:

But your site is requesting them from:

In your /bulkmail/js/selectize/index.js you need to find the line that says $('head').append('<link rel="stylesheet" href="/css/selectize/selectize.' + theme + '.css">'); and change the href="/css..." to href="/bulkmail/css..."

Or just move your stuff to the right directory.