Where are the server logs and PHP logs and can I access them?

I’m trying to get my website working in the new environment - I have the free plan - but its having some problems. It worked perfectly in the old environment but now it’s not working so well.

The pages that are giving me trouble are using PHP and PDO to access the MySQL databases. Some of those pages work okay, some produce errors I’ve never seen before, and some don’t work at all. I’m not a fluent PHP programmer but I’m working with some people on a PHP forum. They suggest that I look at the PHP error logs and the server logs. I expect that’s great advice but I have no idea where those logs are or if I’m allowed to look at them. I have a bad feeling they are going to be in a portion of the server that you don’t want customers to access.

Can anyone tell me if I can see those logs? If so, where can I access them. If not, can I write my own logs somewhere that I can access them, such as a directory below public_html?

For a fine start, please change the PHP version, and check if the errors are fixed: cPanel > Settings > General > Change PHP version > 5.6

For the error log, I don’t know if it’s going to work, but you can give it a shot:

  1. Open File Manager

  2. Open /public_html/.htaccess (if you have no such file, create one)

  3. Append these lines of code to it
    php_flag log_errors on
    php_value error_log HOME-PATH/public_html/domain/PHP_errors.log

Replace HOME-PATH with your Home Directory: cPanel > Details > Home directory

Your errors should now be logged to /public_html/domain/PHP_errors.log

How on earth do I get to cPanel now? When I sign in, I get options for File Manager and Manage Databases but nothing for cPanel.

It’s here: https://www.000webhost.com/cpanel-login

I clicked on the link you suggested and it takes me into my website list. I can’t find any option to access cPanel from there. What do I click on the website list? Nothing I’ve tried clicking on gets me to cPanel.

That is the main cPanel :slight_smile:

From there you click on the website you want to manage, and you’ll be redirected to the selected website cPanel :wink:

Please disregard my previous question. I’ve finally found the setting that changes my PHP version. I was looking for something that at least vaguely resembled the old cPanel but this is completely different.

1 Like

Don’t worry. Is your issue resolved?

No, unfortunately the PHP errors continue in PHP 5.6. I’m going to try an even earlier version of PHP and see if that makes a difference. If it doesn’t, I will have to try your suggestion involving appending the log redirect to .htaccess. I’ll let you know how that turns out.

What error(s) do you get? Please post them here…

I tried going back to PHP 5.2 and get the same errors as in 5.6 and 7.1 although the formatting is a bit different in 5.2.

I suspect that you folks had some of the PHP errors suppressed on the old system - I believe you can do that if you put it in the php.ini file - and that my errors may well be legitimate and reflect code that wasn’t terribly well written in the first place. That’s fine. I can make it better and make the errors go away as I fix them.

The thing that concerns me more is that some of my pages use input forms to generate new database data. When I press Submit on those pages (after filling in valid data), the page just goes blank and fails to insert the data. (It should be giving me a message that says the data was successfully added.) On one of the forms, it just goes away and eventually I get an HTTP 504 telling me that I have a Gateway Timeout. I have no idea at all what is going wrong there. I had no problems with these forms on the old system.

I’m hoping the logs will shed some light on what is going wrong. I’m going to try some logging now and see what happens…

Wow. I just took a giant step BACKWARDS.

Now my SSIs (server side includes) no longer work. That means I can’t see the menu embedded on every page via the SSIs. And that means I can’t select the pages I want to view or navigate my site.

I tried moving the lines you suggested out of the .htaccess file, then removing them entirely so that the .htaccess was the way it had been before but none of that worked.

Now I have to troubleshoot that before I can even begin to deal with the PHP problems.

ARRGGGHHHHH!!!

Now my SSIs (server side includes) no longer work. That means I can’t see the menu embedded on every page via the SSIs. And that means I can’t select the pages I want to view or navigate my site.

The SSI are still supported by 000webhost.

Please append this line to your .htaccess file: AddHandler server-parsed .html

This will enable SSI for .html files. You can add as many directives such as that for as many file types as you wish…

I tried moving the lines you suggested out of the .htaccess file, then removing them entirely so that the .htaccess was the way it had been before but none of that worked.

Sorry, but I told you to append them (write them), not to remove them :confused:

I’m sorry, I don’t understand what you are saying in the last part of your reply. I was trying to tell you that I added the lines you suggested, then my SSIs stopped working so I took the lines you suggested back out. That did NOT fix the problem, my SSIs are still not working.

I’ve tried many other variations in the .htaccess file since then - I used the Apache tutorial on SSIs to guide me - but my SSIs are still broken. This is really getting exasperating. It feels as if SSIs have been turned off across the board for all customers - apparently you can do that in the main configuration files - but I can’t imagine why you would do that. It does, however, match the experience I had when I first built my website several days back. Initially, SSIs would not work for love or money, no matter what changes I tried. Then, suddenly, they started working even though I hadn’t changed anything recently. I never figured that out; I just thanked my lucky stars and got on with cleaning up the website. But now the SSIs are just getting ignored.

I really need to get this working again. Can you tell me what I need to do to get SSIs working? (And yes, I did add your line: AddHandler server-parsed .html,)

I’ve restored my .htaccess files so that it contains only the default lines that your system apparently generates automatically, namely:

# HTID:1177512: DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES BELOW
php_value display_errors 1
# DO NOT REMOVE OR MODIFY THIS LINE AND THE LINES ABOVE HTID:1177512:

(By the way, I think those lines are why I’m getting PHP Notices than I ever used to get in the old system. If I change that 1 to a zero, those messages will likely go away.)

It feels as if SSIs have been turned off across the board for all customers - apparently you can do that in the main configuration files - but I can’t imagine why you would do that.

The SSI are working. One customer with the same problem came by one week ago and we dished things out together.
We just need the proper configuration from .htaccess. Now, the SSI are working for everything else (I’ve tested them), except PHP scripts. And your website is a mine of PHP scripts.

Please wait, and check this topic later. Maybe I can find a fix for it.

(By the way, I think those lines are why I’m getting PHP Notices than I ever used to get in the old system. If I change that 1 to a zero, those messages will likely go away.)

You can turn off any error display by going into cPanel > Settings > General > Show errors > Off :wink:

It’s a great relief to hear that SSIs are working for everyone else. That means it is a problem that is local to me - probably in my .htaccess file - and therefore within my reach. It would be maddening if the problem lay at your end and I spent any more time floundering around trying to fix it on my end :slight_smile:

I would be very grateful if you can figure this out because it is eluding me so far.

For what it’s worth, I want to thank you personally for your efforts here. Human nature being what it is, most people take strong efforts like yours for granted; I do too sometimes. But you’ve been very attentive and responsive to my concerns and I’m not used to that level of support with other comparable services. I feel as if you are actually taking ownership of the problem, not just fobbing me off with a shrug. Well done sir (or madame)!

It’s not a local problem.

Is a global one: PHP files are not parsed as SSI, I don’t know why.

We are sorry for inconvenience :sweat: We’ll notice you when we’ll get it fixed.

I was displaying those pages just fine up until yesterday morning, even though they were PHP files with lots of includes in them. Why did they work up until yesterday morning? I assure you that I haven’t changed more than a few lines a few programs - and the .htaccess file - since then.

If you’re right that it is a global problem, then it seems likely that someone at your end changed something late in the morning yesterday (roughly 9am Eastern time). Maybe that will help you narrow down what happened?

I have just spoke to one of the admins.

SSI support has been disabled for PHP scripts due to of security issues. Sorry :sweat:

Your only options are to edit each .php file and change it into a .html one, or to buy a VPS.

What is a VPS and what does it cost at Hostinger?

Also, are you saying that PHP includes don’t work either or is the restriction limited to true SSI includes using the Apache syntax, e.g.