Reputation: 432
I have been running a CI app on my Apache2 server w/ PHP version "5.5.9-1ubuntu4.2". Everything runs fine.
Now, I installed a second OpenLiteSpeed webserver, which is running PHP version "5.6.5" (I have tried different versions). This server is running in parallel with apache, but on a different port (8088).
Whenever I visit the index.php page of my app, I get a white screen. I have tried adding the default welcome.php controller and view and tried running it with the URL:
http://www.example.com:8088/app/index.php/welcome/
http://www.example.com:8088/app/index.php/welcome/index
http://www.example.com:8088/app/index.php
http://www.example.com:8088/app/index.php/app/ (my app controller)
...etc
Everything is a white screen. If i just pull the 8088 out of the URL (therefore using port 80, my apache server), everything runs perfectly.
I have tried setting all the error log parameters to their maximum values. I have checked my server's error.log and access.log. I have checked the CI generated logs in my /app/application/logs/ folder. I have set OpenLiteSpeed to debug mode and read all the messages. I have set both "display_errors" in php.ini to "On" and verified it with php.info. I have set my app's index.php to development mode.
There are no errors anywhere.
I don't have short tags in any of my php files. I have tried turning short tags on and off inside my php.ini with no effect.
OpenLiteSpeed does not use any .htaccess files. I have a RewriteRule to rewrite non-www to www.
I'm about 16 hours and 20 minutes into solving this problem, with 0 progress.
Any suggestions?
EDIT: Tried moving apache's php.ini over to the OpenLiteSpeed's php. Didn't make any difference.
EDIT: Narrowed it down to the auto-load of "database" and "sessions". Removing these auto-loads fixes the problem, except database functions no longer work.
EDIT: Found the database connection function in the mysql_driver.php. Of course the call is @mysql_pconnect(...), @ suppresses errors, so no wonder i was seeing nothing. After reenabling display_errors in BOTH places in php.ini, i now get
Fatal error: Call to undefined function mysql_pconnect() in /var/www/html/CodeIgniter/database/drivers/mysql/mysql_driver.php on line 94
Seems like php was not compiled with mysql support. Lets recompile.
EDIT: Problem is solved. CI's autoload was loading two libraries 'database' and 'session', both of which were causing the white screen. When I removed them, the error would disappear. I had to recompile PHP with the following options:
--enable-opcache --with-mysql --with-mysqli --with-zlib --with-gd --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbstring --with-iconv --with-libdir=lib64 --with-litespeed --with-curl --enable-zip --with-bz2 --with-jpeg-dir=lib64 --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-exif --with-openssl --with-xmlrpc --with-freetype-dir=lib64 --with-png-dir=lib64 --enable-inline-optimization --enable-xml
So the root cause was improperly configured PHP configuration. But the real problem is with CI being a terrible framework that cannot properly display error information to help you identify problems when they occur. The information is all there, PHP tells you what's wrong, and CI does it's best to hide it so you will never figure out without ~20 hours of trial and error. Super.
Upvotes: 0
Views: 304
Reputation: 432
Figured out the answer. The white screen was cause due to the auto-load of "downloads" and "session" libraries, which were failing silently in the background. I had to recompile PHP with the right options to get it working.
--enable-opcache --with-mysql --with-mysqli --with-zlib --with-gd --enable-shmop --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-mbstring --with-iconv --with-libdir=lib64 --with-litespeed --with-curl --enable-zip --with-bz2 --with-jpeg-dir=lib64 --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-exif --with-openssl --with-xmlrpc --with-freetype-dir=lib64 --with-png-dir=lib64 --enable-inline-optimization --enable-xml
The real issue is that CI was hiding all the error messages that would have made this problem trivial to detect, and it took a huge amount of time just to find the @ surpressed mysql_connection function call that was failing.
Upvotes: 1