php script with mssql and mysqli - cannot run from command line

Currently reading
php script with mssql and mysqli - cannot run from command line

3
1
NAS
412+
Operating system
  1. Windows
I have a php script that used mysqli and mssql (as in php version 5.6)
When I run the script from a browser it runs fine (WebStation).
But if I run it from either a terminal command line or run it as a user-defined scheduled script (in Task Scheduler) it returns mysqli and mssql not found errors.
I have enabled both of these extensions within the WebStation settings.

I already tried command line running php56 from these directories, but still no luck:
/bin/php
/var/packages/PHP5.6/target/usr/local/bin/php56

I need to run the script periodically using Task Scheduler.

Clearly the script can work, but by running it via the command line must load php in a different way.
How does WebStation run php? and can I reproduce that via command line?

How can I find out the path used to run php from within a browser? If I knew that I could probably replicate it in the command line?

Note - already seen this old post:
 
Last edited by a moderator:
Welcome! Good to meet a fellow PHPer on SynoForum. Thank you for posting the work-around. This will be very useful in an upcoming project.

Just to be clear, does "folder1" refer to an optional sub-folder inside the "web" shared folder required by Web Services?

Is it safe to assume your script updates databases, files, logs, etc. but does not produce any "echo" output?

Best Regards, Ron
 
Hi Ron
re. question 'folder1' - yes, just a path to a file.
My scripts do have echo statements but they have no affect.
Also, clearly, the 'curl' extension needs to be enabled.
It would be nice to know the 'correct' solution to this problem though,
rather than bypassing it like this (anyone?)

B.
 
Thanks. Your solution is running just fine here as of this morning. Certainly adequate for a retiree's hobby project. Hope you enjoy the forum. Ron
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

  • Question
I am using a locally hosted Joomla site on Web Station. It was installed using PHP 8.0 but now I want to...
Replies
0
Views
646
It's a bit hit and miss, what I did was to review the site configuration files that were created in...
Replies
3
Views
954
Hey there guys below is the php info of my site. I want to host an ecommerse site on my NAS do you think...
Replies
0
Views
613
Hello, I have a package based web service for a locally hosted Joomla site on Web Station. It was...
Replies
0
Views
1,367
And done, alas I'm stuck with running PHP 7.4 and PHP 8.4 though as if I remove 7.4 it takes out...
Replies
0
Views
814
I answer to my own question just in case someone would be interested : I noticied that the nginx config...
Replies
1
Views
3,822
If it's common for Synology to do this then I'll not worry.
Replies
6
Views
7,586

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Trending threads

Back
Top