Cpanel PHP code checker

walt

Member
Oct 30, 2015
14
0
1
Houston, Tx
cPanel Access Level
Website Owner
Hello, I am using cPanel code editor to write php scripts. If there is an error in the file, often there is no error log generated. I was having a difficult time with this, until I found a nice terminal command 'php -l <filename>'. This has caught every error so far.

However, to use this I have to log into my account using Putty, and if the file has '.inc' extension, it won't show in a directory listing. I have to first change the extension to .php from cPanel.

Is there something equivalent to 'php -l <filename>' that I could use from cPanel? Maybe an app I could install or turn on?

Thanks!

Shared hosting account info:
Code:
grep '' /etc/redhat-release /usr/local/cpanel/version /var/cpanel/envtype ; grep CPANEL= /etc/cpupdate.conf ; httpd -v ; php -v ; mysql -V

grep: /etc/redhat-release: No such file or directory
/usr/local/cpanel/version:11.48.4.8
/var/cpanel/envtype:standard
grep: /etc/cpupdate.conf: No such file or directory
-jailshell: httpd: command not found
PHP 5.4.45 (cli) (built: Oct  5 2015 15:35:12)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
  with the ionCube PHP Loader v4.7.4, Copyright (c) 2002-2014, by ionCube Ltd., and
  with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
mysql  Ver 14.14 Distrib 5.5.42-37.1, for Linux (x86_64) using readline 5.1
 

walt

Member
Oct 30, 2015
14
0
1
Houston, Tx
cPanel Access Level
Website Owner
Thanks kernow, ls -lah works. I was using ls -al.

I read somewhere that, for security reasons, there is a server setting that will not allow certain files to be listed (only remotely?). I did not feel like trying to change this setting, however ls -lah is showing all the files. Great!

I'm logging in using Windows xp. I do have a small Linux computer that I could try logging in with. Would there be any advantages of logging in with a Linux computer?

Edit: Just realized that asking a Linux user if there are advantages over Windows is probably an insult! Apologies, didn't mean it that way :)
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
If there is an error in the file, often there is no error log generated.
Hello :)

Do you have root access to the server? If not, you can report this issue to your web hosting provider to see if they can modify the error reporting configuration for PHP.

Thank you.
 

walt

Member
Oct 30, 2015
14
0
1
Houston, Tx
cPanel Access Level
Website Owner
@cPanelMichael, thanks for your reply. I will try and learn a bit about php error logging before I ask them to do anything, just in case this is a 'beware what you ask for' case .

For now logging in with Putty, and using 'php -l' is working great, thanks to kernow pointing out how to list hidden files with the 'ls -alh' command. Now it occurred to me that access to a terminal window, from cPanel, would be very handy. Could this be added under the 'advanced' tab?

@kernow
When xp was phased out, I bought a small single board Linux computer to learn about Linux. It has a 1Ghz dual core A20, 1GB ram and I added a hard dive. If it has a multitasking limit, I have not reached it yet. The processor only has a passive 3/4 x 3/4" heat sink. At 100% load, it's barely warm to the touch. I can't imagine what a modern Linux laptop would be able to do, and it's very tempting to look into it.
 
Last edited: