Page 1 of 2
View php syntax errors
Posted: Wed Apr 19, 2023 9:06 pm
by treed
Is there a way to view syntax errors when developing php procedures? I'm sure no one else makes them, but I do and it would be a lot easier to find and fix my problems if the messages were visible in the window.
Re: View php syntax errors
Posted: Wed Apr 19, 2023 11:03 pm
by nc07
treed wrote: ↑Wed Apr 19, 2023 9:06 pm
Is there a way to view syntax errors when developing php procedures? I'm sure no one else makes them, but I do and it would be a lot easier to find and fix my problems if the messages were visible in the window.
hope this helps:
https://forums.nubuilder.cloud/viewtopic.php?t=11912
Re: View php syntax errors
Posted: Thu Apr 20, 2023 12:23 am
by treed
While code checkers are a great idea, they'll probably choke on all the nuBuilder specific code. If I could just my run the nuBuilder code through command line PHP I would.
Re: View php syntax errors
Posted: Thu Apr 20, 2023 7:44 am
by kev1n
Double-click on the textarea that contains code to open the Ace Editor. Errors will be highlighted.
Re: View php syntax errors
Posted: Fri Apr 21, 2023 9:02 pm
by BoydG
I don't know if you have access to the server where your PHP is running but in my case, my hosted provider allows me to view the phplog file.
This is where I usually find PHP syntax errors, I can also use the debug command in my PHP procedures to write to that file.
Re: View php syntax errors
Posted: Mon Apr 24, 2023 7:07 pm
by treed
BoydG wrote: ↑Fri Apr 21, 2023 9:02 pm
I don't know if you have access to the server where your PHP is running but in my case, my hosted provider allows me to view the phplog file.
This is where I usually find PHP syntax errors, I can also use the debug command in my PHP procedures to write to that file.
The server is sitting right next to me.

I've found useful info in the apache2 log file. Where do you find the phplog file? I'm on Ubuntu.
Re: View php syntax errors
Posted: Mon Apr 24, 2023 7:44 pm
by kev1n
By default, PHP error logs are usually stored in the system log directory of Ubuntu. The specific location of the log file may vary depending on the PHP version and configuration.
You can find the PHP log file path by checking the php.ini configuration file or by running the following command in your terminal:
This will display the configuration files parsed by PHP, including the path to the php.ini file.
In most cases, the PHP error log file is named error.log and is located in the /var/log directory. You can view the contents of the PHP error log file by running the following command:
Code: Select all
sudo nano /var/log/apache2/error.log
Note that the location and file name of the PHP error log may be different depending on your server configuration, so it's always a good idea to check the PHP configuration files or consult your system administrator.
Re: View php syntax errors
Posted: Mon Apr 24, 2023 7:51 pm
by treed
Thanks, that's the file I'm using.
The Atlas editor does work well for simple errors (if I can figure out where it is), but goes apoplectic on some code from PHP libraries and then shows nothing but that one error. Still trying a good way to debug PHP as it looks like I'll be doing quite a bit of it.
Re: View php syntax errors
Posted: Sat Jun 17, 2023 1:36 am
by treed
I'm bring this up again because I'm doing a lot of PHP work and there has to be a better way. While I did name the thread syntax errors, perhaps that's not really what I wanted. Here's an example when writing a file to disk, the path may be bad while the syntax is perfect. PHP will tell me that info in an error message. Is there a way to show this information in the window the PHP is running in?
Re: View php syntax errors
Posted: Tue Sep 19, 2023 12:42 am
by kev1n
PHP nuEval() has been improved to catch syntax errors (Update on Github).
Let me know if it works for you.