Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a PHP application. The application runs flawlessly on Windows version of Apache 2.2.8 and PHP 5.2.5. (part of ms4w; MapServer for Windows). I'm also using Windows XP for development purposes.
Now I have compiled Apache 2.2.14 and PHP 5.2.11 on CentOS 4.2, x86, 32-bit. My directory is /usr/local/apache2/htdocs/. My PHP directory is /usr/local/apache2/php/.
I have a PHP application named kbn-gis.php. it is stored in /usr/local/apache2/htdocs/kbn-gis/ directory.
When I have copied the application to the CentOS box, the page just refuses to load. Firefox just give me a totally blank white page, while in Opera, it takes forever to load kbn-gis.php.
It is actually a PHP MapScript (MapServer) application, but I don't think the problem is MapServer-related, because I have written small PHP pages on the CentOS box, to test the functionalities of php_mapscript.so module. Everything works fine. The small PHP pages can display vector data, raster data, and vector data stored in PostgreSQL PostGIS.
Likewise, I don't really believe there is something wrong with the CentOS' PHP. I ran phpPgAdmin (a web-based administration console for PostgreSQL), and it goes flawlessly.
What's wrong? Here's the following codes of kbn-gis.php:
Ah yes, when I do ls from PuTTy, the PHP file I unable to load (kbn-gis.php) is colored green. The PHP files I written using vi (directly on the server), which is run flawlessly on the CentOS box, is colored white. Does it matter? However, I already did "chmod 777", "chown root", and "chgrp root" on the kbn-gis.php.
The white-colored PHP files is also owned by root.
I have run php from cli, and apparently I got a lot of undefined indexes:
Code:
[root@kbnweb kbn-gis]# /usr/local/apache2/php/bin/php kbn-gis.php
PHP Notice: Undefined index: lang in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 4
PHP Notice: Undefined index: scope in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 5
PHP Warning: Module 'MapScript' already loaded in Unknown on line 0
PHP Notice: Undefined index: current_extent in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 81
PHP Notice: Undefined index: current_x_map in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 82
PHP Notice: Undefined index: current_y_map in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 83
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 54
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 54
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 57
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 57
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 60
PHP Notice: Undefined index: click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 60
PHP Notice: Undefined variable: img_click_mode in /usr/local/apache2/htdocs/kbn-gis/include/general.php on line 63
PHP Notice: Undefined index: warehouses_and_factories in /usr/local/apache2/htdocs/kbn-gis/include/layers.php on line 11
PHP Notice: Undefined index: available_for_rent in /usr/local/apache2/htdocs/kbn-gis/include/layers.php on line 11
PHP Notice: Undefined index: facilities in /usr/local/apache2/htdocs/kbn-gis/include/layers.php on line 11
PHP Notice: Undefined offset: 1 in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 89
PHP Notice: Undefined offset: 2 in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 89
PHP Notice: Undefined offset: 3 in /usr/local/apache2/htdocs/kbn-gis/kbn-gis.php on line 89
However, I also ran php cli on a small PHP page that I coded directly on the Linux (using vi), and I got undefined indexes as well. The difference is; this one runs without problem, while the former cannot be load at all by the browser.
Code:
[root@kbnweb kbn-gis]# /usr/local/apache2/php/bin/php test-cakung-in.php
PHP Notice: Undefined index: lang in /usr/local/apache2/htdocs/kbn-gis/test-cakung-in.php on line 2
PHP Notice: Undefined index: scope in /usr/local/apache2/htdocs/kbn-gis/test-cakung-in.php on line 3
<html>
<body bgcolor="#CCCCCC">
<center>
<H1>Test GIS Page</H1>
<P>
PHP Warning: Module 'MapScript' already loaded in Unknown on line 0
<img src=temp/4b094c42_1fbd_0.jpeg >temp/4b094c42_1fbd_0.jpeg
</body>
</html>
Both have undefined indexes, but kbn-gis.php cannot even be loaded by the browser, while test-cakung.php runs flawlessly.
By the way, I coded kbn-gis.php on Windows, using Notepad++, while test-cakung.php was coded directly on the CentOS box, using vi. Does it matter?
I don't have a good white space remover, so I take the "dirty way" of removing white space; namely, copy paste from Notepad++ to the vi on my PuTTy window.
It solves the problem... partially. See, the page runs now, but it is only loaded partially. When I do "view source" from either Firefox or Opera, the page stops at this point:
Code:
<input type="HIDDEN" name="
instead of:
Code:
</html>
The rest of lines after <input type="HIDDEN" name=" is never processed, never displayed by any browser I tried.
It is because the whitespace, isn't it? What is the best whitespace remover, then? Thanks.
Normally, if you insist on editing on MS, then uploading to linux, you'd use dos2unix, which converts the line endings.
Personally, I'd recommend finding a Linux editor you can live with and using that exclusively.
But, I just found out that copy-pasting to VI does convert the text to Linux. Thus, the problem about partially-load PHP page above is not cause by incompatible line feed.
Like I said above, the production server's never loads the page fully, ie, when showing the codes in a browser, it never reaches the closing </html> part. And it has nothing to do with bandwitdh either, I have tried browsing locally from the server itself.
I have to admit that my php page is quite large, about 9 kilobytes. It also has a lot of "echo" commands. The page also contains a lot of tab.
Recently I found out that it has something to do with output_buffering parameter in php.ini. Starting from zero, if I increase the output_buffering value, the loaded portion of my PHP page also increases. So I think if I max the output_buffering value, my PHP page will be fully loaded by the server.
Alas, that's not the case.
See, when I reach certain value, the loaded portion of the PHP page decreases again. The page reaches its biggest portion in output_buffering=1024. Increasing it to 1025, for example, doesn't change anything. But when I set it to 1210, the
Apparently, output_buffering=1024 is the "optimum" setting, although it still fails to load the PHP page fully. The page you see below is not the full PHP page, by the way. http://i3.photobucket.com/albums/y71...g_1024_wip.jpg output_buffering=1024
I don't know if it is relevant, but originally, the php.ini has extension_dir = './' Problem is, I don't know what does it mean by './' (is it /usr/local/apache2/php ? is it /usr/local/apache2/lib ?). On the other hand, I need to dl php_mapscript.so into my PHP page, which I put in PHP installation prefix (/usr/local/apache2/php). So I hardcoded the extension_dir into '/usr/local/apache2/php'.
In short, what's wrong? Why the production server cannot load my PHP page fully? What should I do? Please help.
By the way, I forgot to mention, but I also tried using implicit_flush = On. When I use implicit_flush = On with output_buffer = 0, it works just exactly like using implicit_flush = Off with output_buffer = 1024.
However, increasing output_buffer with implicit_flush = On does not improve the situation. For example, using implicit_flush = On with output_buffer = 1024 does not fully load the PHP page either. Seems like nothing can fully load my PHP page.
Ah, I've just found something new: the same output_buffering value does not always give consistent result.
For example, I just set output_buffering value to 3650, which showed most (alas, not the entire) of my PHP page. But about five minutes later, the same 3650 value just gave me a totally blank page (just like when I'm using output_buffering=On)
By the way, and I don't know if it's relevant, but it is a production server, which is also used by the "primary" website and a web mail server.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.