Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-05-20 04:57:25
Point:500 Replies:10 POST_ID:828507USER_ID:11059
Topic:
PHP Scripting Language;;Linux
Dear Expert,
I get one simple php script test and program on my Linux shell command line
like myuser@mydomain/public_html/php myprogram.php , and I got the fatal error
out of memory (allocated 8388608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
But interesting that is if I run it in IE browser, it works succesfully
Running it in IE, it will echo memory usage=8,588,338 when $c<50,000, so i means it run succesfully at http://mydomain.com/myprogram.php
Runing it in IE ,it will echo memory usage=41,000,000 when $c<200,000, so it means it run sucessfully at http://mydomain.com/myprogram.php
Running it in Linux command line, it won't echo memory usage, and it stdout the
Fatal error:out of memory (allocated 8388608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
on line 4.
so it won't run correctly.
If it can run in IE for the same script, it means the probelm is not issue at memory_limt setting in php system and the script shoud cost less than
41Meg when $c<50,000. And running it in IE , it is no issue for 41Meg memory when $c <200,000
I talked to my share-server company support, they replied and confirmed and I checked my php memory limit is 128Meg already
The issue they reply that might be PHP version is not set correctly in my script, myprogram.php if running it at command line shell.
Do you agree that ?
How can I set correct PHP version in php script ? I think that issue is not related to memory_limit setting and PHP version
setting, it might relate to they might limit my php script running at command line, but no limit when run it in IE broswer
I go to check it in Cpanel for php configurate, memory_limt is 128Meg already and
I go to check it in phpinfo() in Linux php script, it also report 128meg already and
I go to check ,htaccess file, php_value memory_limit 128M is also set already
So the issue is related to what ? memory allocation issue at command line or others ?
Please advise
Duncan
I get one simple php script test and program on my Linux shell command line
like myuser@mydomain/public_html/php myprogram.php , and I got the fatal error
out of memory (allocated 8388608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
But interesting that is if I run it in IE browser, it works succesfully
Running it in IE, it will echo memory usage=8,588,338 when $c<50,000, so i means it run succesfully at http://mydomain.com/myprogram.php
Runing it in IE ,it will echo memory usage=41,000,000 when $c<200,000, so it means it run sucessfully at http://mydomain.com/myprogram.php
Running it in Linux command line, it won't echo memory usage, and it stdout the
Fatal error:out of memory (allocated 8388608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
on line 4.
so it won't run correctly.
If it can run in IE for the same script, it means the probelm is not issue at memory_limt setting in php system and the script shoud cost less than
41Meg when $c<50,000. And running it in IE , it is no issue for 41Meg memory when $c <200,000
I talked to my share-server company support, they replied and confirmed and I checked my php memory limit is 128Meg already
The issue they reply that might be PHP version is not set correctly in my script, myprogram.php if running it at command line shell.
Do you agree that ?
How can I set correct PHP version in php script ? I think that issue is not related to memory_limit setting and PHP version
setting, it might relate to they might limit my php script running at command line, but no limit when run it in IE broswer
I go to check it in Cpanel for php configurate, memory_limt is 128Meg already and
I go to check it in phpinfo() in Linux php script, it also report 128meg already and
I go to check ,htaccess file, php_value memory_limit 128M is also set already
So the issue is related to what ? memory allocation issue at command line or others ?
Please advise
Duncan
myprogram.php==========================<?phpini_set('memory_limit', '128M');for ($c=0 ;$c<50000;++$c) {$linerow[$c]="aaaaaaaaaaaaaaaaaaaaaaaaaa";}echo "memory usage=".memory_get_usage(). "";?> 1:2:3:4:5:6:7:8:9:10:
Author: duncanb7 replied at 2024-05-22 10:22:56
THanks for your reply
it is cauesd by my host company
at max locked memory proved
if i check it in ulimit -a
that is only 32k for share-server
it is cauesd by my host company
at max locked memory proved
if i check it in ulimit -a
that is only 32k for share-server
Author: duncanb7 replied at 2024-05-21 01:43:43
System already set memory_limit=128M in php.ini and .htaccess
and we conclude the setting in php.ini and .htacess for Aapache only and not work for command line
we could not find out where the other php.ini is for command line and start a test to solve the issue as follow
Testing:
================
Test-1
php -f myprogram.php
Fatal Error: out of memory (allocated 8,388,608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
Test-2
php -n -d memory_limt=128Meg -f myprogram.php / /where -n "No php.ini file can be used"
Fatal Error: out of memory (allocated 27,262,000)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
Test-3
php -n d memory_limited=1Meg -f myprogram.php //for tesitng 1Meg setting
Fatal Error: Allowed memory size of 1Meg is exahusted
You can see only Test-3 is related to memory limit issue if you read the error message in which you can find the word of "exhaousted"
In test-1 and test-2, they might not be related to memory_limit, it might be caused by other setting in ulimit -a command setting
Please advise why even we use -n option but we can allocated more than 27.3Meg memory with memory_limit=128M set at command line ?
Duncan
and we conclude the setting in php.ini and .htacess for Aapache only and not work for command line
we could not find out where the other php.ini is for command line and start a test to solve the issue as follow
Testing:
================
Test-1
php -f myprogram.php
Fatal Error: out of memory (allocated 8,388,608)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
Test-2
php -n -d memory_limt=128Meg -f myprogram.php / /where -n "No php.ini file can be used"
Fatal Error: out of memory (allocated 27,262,000)(tried to allocated 71 byte) in /home/mydomain/public_html/myprogram.php
Test-3
php -n d memory_limited=1Meg -f myprogram.php //for tesitng 1Meg setting
Fatal Error: Allowed memory size of 1Meg is exahusted
You can see only Test-3 is related to memory limit issue if you read the error message in which you can find the word of "exhaousted"
In test-1 and test-2, they might not be related to memory_limit, it might be caused by other setting in ulimit -a command setting
Please advise why even we use -n option but we can allocated more than 27.3Meg memory with memory_limit=128M set at command line ?
Duncan
Assisted Solution
Expert: Dave Baldwin replied at 2024-05-20 15:36:17
167 points EXCELLENT
Also, nothing in '.htaccess' is used when you run from the command line. '.htaccess' is only used by Apache.
Assisted Solution
Expert: Dave Baldwin replied at 2024-05-20 15:34:46
166 points EXCELLENT
First, PHP Only runs on the server, not in the browser. But second, in current distributions of Linux, Apache2 usually has one copy of 'php.ini' that is used when PHP is run thru the server and there is a second copy somewhere in one of the PHP directories that is used when you run PHP from the command line. They do not have to be the same. Tell us what version of Linux you are running.
Expert: _alias99 replied at 2024-05-20 14:10:54
duncanb7,
A message has been sent to some additional experts asking them to review your question. We will check back again to see if you are getting the help you need.
This request included Experts from PHP Scripting Language, Linux.
Please do not respond to this comment; we will be monitoring your question for activity from the Experts.
Thank you for using Experts Exchange,
_alias99
Community Support Moderator
http://www.experts-exchange.com/Q_27050737.html
A message has been sent to some additional experts asking them to review your question. We will check back again to see if you are getting the help you need.
This request included Experts from PHP Scripting Language, Linux.
Please do not respond to this comment; we will be monitoring your question for activity from the Experts.
Thank you for using Experts Exchange,
_alias99
Community Support Moderator
http://www.experts-exchange.com/Q_27050737.html
Author: duncanb7 replied at 2024-05-20 07:23:44
It is improved a bit if using
php -qn -d memory_limt=128Meg myprogram.php
from the suggestion at http://www.scottswezey.com/blog/2010/increasing-the-php-cli-memory-limit/
But the error is still fatal error (allocated 27,262,000) .............
Why it is improved because we can see the allocated memory is increasing from 8,588,338 to 27,262,000) More
memory has been allocated for myprogram.php with adding option -qn where -n means no reading php.ini file
php -qn -d memory_limt=128Meg myprogram.php
from the suggestion at http://www.scottswezey.com/blog/2010/increasing-the-php-cli-memory-limit/
But the error is still fatal error (allocated 27,262,000) .............
Why it is improved because we can see the allocated memory is increasing from 8,588,338 to 27,262,000) More
memory has been allocated for myprogram.php with adding option -qn where -n means no reading php.ini file
Author: duncanb7 replied at 2024-05-20 06:20:50
Any suggestion ?
Author: duncanb7 replied at 2024-05-20 05:40:10
Is php -d memory_limt[=128M] /home/......php ? but is also get the same fatal error message
Author: duncanb7 replied at 2024-05-20 05:36:44
it get the same fatal error result
when running php -d memory_limit.php /home/mydomain/public_html/myprogram.php
Why ? Where is memory_limit.php ? Do I need to create it ?
when running php -d memory_limit.php /home/mydomain/public_html/myprogram.php
Why ? Where is memory_limit.php ? Do I need to create it ?
Accepted Solution
Expert: hernst42 replied at 2024-05-20 05:25:26
167 points EXCELLENT
memory_limit can not be changed via ini_set (See ini-definition in the php manual)
Form the command line try:
php -d memory_limit.php /home/mydomain/public_html/myprogram.php
php on the command line uses another php.ini as you webserver. compare phpinifo from command line with that from your webserver
Form the command line try:
php -d memory_limit.php /home/mydomain/public_html/myprogram.php
php on the command line uses another php.ini as you webserver. compare phpinifo from command line with that from your webserver