Link to home
Start Free TrialLog in
Avatar of Debra Turner
Debra TurnerFlag for United States of America

asked on

PHP Startup Error

I am having a problem with a recurring PHP startup error message(s).
(Using PHP 7.07 on IIS 8.5 and Codeigniter 3.0)

•      I have set the PHP Error Reporting to Production Machine in the IIS PHP manager
•      I have set display_errors to Off
•      I have set display_startup_errors to 0 (it was set as Off, but that didn’t work so I’m trying the 0)
•      I’ve set the error_reporting Environment variable to ‘production’ in Codeigniter

And I’m still getting errors like the one below. Do you have any experience in this? I’m not sure what else to try. After making all of these changes, I’ve restarted IIS. It’s weird, because I get the error and refresh the page, and then it goes away. Here is the link, http://casweb.memphis.edu/suapp-research/index.php/post/show 

BTW – all of the files in question are in the correct directory

Error is below:

A PHP Error was encountered

Severity: Core Warning

Message: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.0\ext\php_pdo_sqlsrv_7_ts_x64.dll' - The specified module could not be found.

Filename: Unknown

Line Number: 0

Backtrace:

Any help at all is appreciated.
Debra
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

It looks like SQL Server is not installed.  IIRC, this is a separate installation, not bundled with PHP.

Also, when you're at this point in the application lifecycle (trying to get an installation to work, before building any applications), it might be helpful to set things up for error logging.  Here are my settings.
display_errors	On	On
display_startup_errors	Off	Off
error_append_string	no value	no value
error_log	error_log	error_log
error_prepend_string	no value	no value
error_reporting	no value	no value
log_errors	On	On
log_errors_max_len	1024	1024

Open in new window

In my code (PHP script files) I usually use something like this:
error_reporting( E_ALL );
ini_set( 'display_errors', TRUE );
ini_set( 'log_errors',     TRUE );

Open in new window

You might want to turn off the display_errors because it may interfere with the way some frameworks operate.
Avatar of skullnobrains
skullnobrains

"startup errors" do not apply to libraries loaded through extensions.ini

for that you'd have to redirect php's stderr to a log file in the web server which might or not be feasible when using php as a module in IIS, i have no idea.

if it says the file could not be found, it really couldn't. are you sure you don't have multiple configs in IIS, some of them chrooting or proxying to a different server... or a page loading initially in a virtual server and for some reason redirecting differently ( different referral for example ) next time you try.

can you post log extracts of queries w/o the error ?
She' trying to load a 'ts' extension when for IIS it should be the 'nts' extension.  And yes it can cause a startup error, I've managed to do that.  The ODBC 13 or 14 driver must also be installed for the 'sqlsrv' driver to come up.  I wrote an article about this back in May:  https://www.experts-exchange.com/articles/28391/PHP-and-Microsoft-SQL-Server.html
Avatar of Debra Turner

ASKER

Thank you for your help,

I am accessing a SQL database not on the local server - does that matter that it is not installed?

My settings are the same as  Ray Paseur settings. Except for the display_errors - why would i have them on if production server?

display_errors Off Off
display_startup_errors Off Off
error_append_string no value no value
error_prepend_string no value no value
log_errors On On
log_errors_max_len 1024 1024

This is from my PHP_via_FastCFI_errors log

[27-Oct-2016 17:21:40 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.0\ext\php_pdo_sqlsrv_53_ts.dll' - The specified module could not be found.
 in Unknown on line 0
[27-Oct-2016 17:21:40 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.0\ext\php_pdo_sqlsrv_54_ts.dll' - The specified module could not be found.
 in Unknown on line 0
[27-Oct-2016 17:21:40 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\v7.0\ext\php_pdo_sqlsrv_7_ts_x64.dll' - The specified module could not be found.
 in Unknown on line 0

Since it is looking for a pdo dll, would this setting in my phpinfo() output be a problem?

PDO support enabled
PDO drivers  odbc  

Thank you,
debra
it can cause a startup error

sure. my point was you can't capture it with "display_startup_error" directives and the likes. these would capture stuff such as using an undefined function, requiring a missing file or multiple declaration on the same function outside of control structures.... but not dll loading errors which occur before "startup" ( of the php script ). thanks for pointing out
I am accessing a SQL database not on the local server - does that matter that it is not installed?

the server needs not be installed. the client needs to be. installing the server usually installs the client as well.

--

as far as display error go, my personal thinking is that you should enable them on any server including in production. a blank page is not much better than a parse error in my opinion and is much more difficult to debug when you need to.

i consider reasonable to change the error levels so you don't get notifications on production servers if you esteem your coding guidelines allow you to use undeclared variables and the likes like a great many of us php coders do
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just re-downloaded the 4.0 drivers from Microsoft (it says it is for PHP 7.0+) - but it still does not include the php_pdo_sqlsrv_53_nts.dll

So I quoted out the extension in .ini to see if that was the problem.

Restarted the server. Now the error is...

 A PHP Error was encountered

Severity: Core Warning

Message: Module 'sqlsrv' already loaded


Any suggestions?
These are the extensions commented out in my php.ini
Is this correct? And could you please tell me how to get the extension=php_pdo_sqlsrv_53_nts.dll driver? That is the only one I do not have.

extension=php_sqlsrv_53_nts.dll  
extension=php_sqlsrv_54_nts.dll  
extension=php_pdo_sqlsrv_53_nts.dll
extension=php_pdo_sqlsrv_54_nts.dll
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_sqlsrv_7_nts_x64.dll

I appreciate your help
debra
Hi Dave Baldwin,
After reading your article (you posted the link) and digging a little deeper into the nts dll files information, I was able to find the right drivers to load and un-comment the right extensions to get rid of the error.
Thank you for your help!
Debra
You're welcome.  Glad my article helped someone!