Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

View php syntax errors

Questions related to customising nuBuilder Forte with JavaScript or PHP.
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

View php syntax errors

Unread post 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.
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: View php syntax errors

Unread post 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
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: View php syntax errors

Unread post 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.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: View php syntax errors

Unread post by kev1n »

Double-click on the textarea that contains code to open the Ace Editor. Errors will be highlighted.
BoydG
Posts: 35
Joined: Mon Dec 31, 2018 10:31 am

Re: View php syntax errors

Unread post 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.
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: View php syntax errors

Unread post 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.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: View php syntax errors

Unread post 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:

Code: Select all

php --ini
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.
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: View php syntax errors

Unread post 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.
treed
Posts: 205
Joined: Mon May 18, 2020 12:02 am
Been thanked: 2 times
Contact:

Re: View php syntax errors

Unread post 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?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: View php syntax errors

Unread post by kev1n »

PHP nuEval() has been improved to catch syntax errors (Update on Github).
Let me know if it works for you.
Post Reply