PHP escapeshellarg() Issue, with CodeIgniter [duplicate] - php

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
escapeshellarg() has been disabled for security reasons
I've created an image upload system with PHP and it all works but I still get a warning:
A PHP Error was encountered
Severity: Warning
Message: escapeshellarg() has been disabled for security reasons
Filename: libraries/Upload.php
Line Number: 1066
Does anyone know how to get rid of this without contacting Hosting provider?

You can't. You will have to contact your sys admin to enable that function for you, or use something else (that does not involve executing shell commands) for what you are trying to accomplish.

Try replacing escapeshellarg with #escapeshellarg.
Because, then you'd be suppressing any warning that function call gives.
Since
it all works
Doing that shouldn't be a problem to your working code.
Note: using # to suppress warnings or errors is not recommended.

Related

msql_connect warning fix [duplicate]

This question already has answers here:
Deprecated: mysql_connect() [duplicate]
(12 answers)
Closed 6 years ago.
I've got some older software that was written a few years ago but is now unsupported so I can't simply upgrade to resolve this issue.
Meaning; that I cannot go to the vendor and get a software update to resolve it.
I'm getting an error on all my pages because of this 1 line of code. I know what needs to happen to it but because I don't do much SQL programming I'm unsure how to implement it.
The code:
$dblink = mysql_connect(SB_HOST_NAME,SB_DB_USER_NAME,SB_DB_PASSWORD) OR DIE("Unable to connect to database");
The error:
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/kribs/public_html/stconfig.php on line 117
Warning: Cannot modify header information - headers already sent by (output started at /home/kribs/public_html/stconfig.php:117) in /home/kribs/public_html/key/openinfo.php on line 248
I've come across the article saying it needs to use the newer format but not sure how it applies to this situation.
Any help is much appreciated, I will continue reading to see if I can resolve it in the mean time.
The original MySQL extension is now deprecated, and will generate E_DEPRECATED errors when connecting to a database. Instead, use the MySQLi or PDO_MySQL extensions.
http://php.net/manual/en/migration55.deprecated.php
You can turn off those warnings with error_reporting
Here You go:
// Report all errors except E_DEPRECATED
error_reporting(E_ALL & ~E_DEPRECATED);

PHP Warning Cannot Modify Header Information [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
My site is running fine on one server but when I shifted it to another server, some pages are giving following warning message.
Warning: Cannot modify header information - headers already sent by (output started at /home/parviz/public_html/ganj_videos/lang/english.php:1) in /home/parviz/public_html/ganj_videos/mobile/detect.php on line 50
Any idea on how to fix it?
Thanks.
Most likely your new server has a different setting for the errors and warnings. If PHP issues a warning or error as output then it will cause your headers to fail.
Change the level using the error_reporting function.
Just follow the debug: it says output started in file /home/parviz/public_html/ganj_videos/lang/english.php on line 1. There's most probably some messy newlines or spaces there. Make sure all php files executed start with <?php and NOTHING else before it, or you'll get the warning.

Warning: `exec()` has been disabled for security reasons [duplicate]

This question already has answers here:
Warning: exec() has been disabled for security reasons
(2 answers)
Closed 9 years ago.
I upload a gif to my website. When is upload complete, i can see this error:
Warning: exec() has been disabled for security reasons in /data/web/virtuals/28995/virtual/www/include/functions/main.php on line 306
Fatal error: Call to undefined function execute() in /data/web/virtuals/28995/virtual/www/include/functions/main.php on line 309
And this is part from main.php
$owh = $width_old."x".$height_old;
$nwh = $final_width."x".$final_height;
if(!file_exists($temppic))
{
$runinbg = "convert ".$file." -coalesce ".$temppic;
$runconvert = execute("$runinbg");
}
$runinbg = "convert -size ".$owh." ".$temppic." -resize ".$nwh." ".$output;
$runconvert = execute("$runinbg");
return true;
Thank you for help! :-)
Just as additional information:
There is a php.ini directive called disable_functions. Functions added to this list will be disabled by PHP and when you try to execute those functions, you get this error. As mentioned, in all probability your hosting provider has added exec to the disabled list. This is a common practice in shared hosting. You will need a dedicated server if you really want to run exec (or some hosting provider who provides pseudo-exec functionality). It is a bad idea to trust a shared hosting provider who allows you to run exec unrestrained.
Those errors mean just what they say.
Fatal error: Call to undefined function execute()
You are calling a function that doesn't exist.
Warning: exec() has been disabled for security reasons
Your web host has disabled the exec() method, you won't be able to run background scripts (like it appears you are attempting to do). You'll need to find another way to accomplish your goal, or find another web host.

Codeigniter, getting PHP error after moving server folder [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
I tried to move my codeigniter server folder to Amazon EC2 server.
I zipped whole file with "tar cvfpz" command and move the file to new server.
I unzipped by using "tar xvfpz" command.
My new server setting is fine, but I get this error.
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/playmobs/_application/controllers/home.php:188)
Filename: core/Common.php
Line Number: 442
404 Page Not Found
The page you requested was not found.
I checked the database config file and all other config files.
All of them have correct commands for new server.
Can you see why I see this error?
Thank you.
You get this error, because probably you send output before sending header. This error can have a lot of reasons.
Here is really well documented solution: How to fix "Headers already sent" error in PHP
I solved the problem.
The reason was that I moved to the new server and didn't turn on PHP short cut command.
my code was like this.
<? ----- ?>
New server php didn't recognized this one.

Call to undefined function domxml_new_doc() [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to solve “call to undefined function domxml_new_doc()…”
I'm using php5, when I try initializing a domxml_new_doc() it gives following error
Call to undefined function domxml_new_doc()
I checked phpinfo and found that DOM/XML is enabled...
Here is the code line which gives me the error
$doc = domxml_new_doc("1.0");
As suggested by KingCrunch, you're likely to be using PHP5. In that case, just use DomDocument instead.
However if you're still using PHP4, then the following test will tell you whether the extension is loaded:
var_dump(extension_loaded('domxml'));
If it returns false, then you have to enable the domxml library.
If you can modify php.ini, then locate a line extension=domxml.so (unix) or extension=domxml.dll (windows), uncomment it, then restart the web server.
If you cannot find this line, then you may have to install this library, which is outside the scope of this question :)

Categories