Welcome Guest, Not a member yet? Register   Sign In
where to put php.ini exactly ?
#1
Wink 

Good morning everybody !  Blush

I am facing a problem with a custom php.ini, here is the point:

I am hosted at 1&1 on a shared server, with 64M of max_upload_filesize and max_execution_time at 50000.
I have a controller with an upload function in standard PHP which calls (once uploaded) another private function into the same controller to end the job.

It seems to me that the php.ini values are too short, because over 35M, the files are not uploaded.  I tried to append some php_value to the htaccess and got an artistic error 500. Then, I put a personnal  PHP.ini file with only 


PHP Code:
upload_max_filesize 200M
post_max_size 
200M 

 inside to see what happens, and here is the problem : 
when I put the ini file inside the controller's folder, nothing happens and a ini_get() returns 64M and when I put it inside the root, I have a full white screen.
I have called 1&1 and the guys confirmed that I can override the php.ini by placing this file in the root. But as told, it gives me this infamous white screen  Sad

Is there any particular reason to get this white screen, or should I modify something in the CI configuration ? Or is there anything to see with the custom script and not the CI upload library ?

I read in another thread that the CI ini_set() was not efficient, so there is just the php.ini to solve that I think.

If anybody can advise me, it would be great

Thanks in advance

Guillaume
Reply
#2

(This post was last modified: 03-11-2017, 02:45 AM by GBNet.)

Little precision, when I switch to devellopment environment, I get this :

A PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 118

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /homepages/23/d572140987/htdocs/myxxx/system/core/Exceptions.php:272)

Filename: core/Common.php

Line Number: 568

Backtrace:

An uncaught Exception was encountered

Type: Exception

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.

Filename: /homepages/23/d572140987/htdocs/myxxx/system/libraries/Session/drivers/Session_files_driver.php

Line Number: 120

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once


Should I search rather in CI or rather to my hosting company ?

Thx !
PS : when I remove the php.ini, I have no error in dev env.
Reply
#3

You will have to contact your web provider, some don't allow you to change values in php.ini

For .htaccess you can try this:

Code:
php_value memory_limit 128M
php_value post_max_size 200M
php_value upload_max_filesize 200M
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(03-07-2017, 05:17 AM)InsiteFX Wrote: You will have to contact your web provider, some don't allow you to change values in php.ini

For .htaccess you can try this:

Code:
php_value memory_limit 128M
php_value post_max_size 200M
php_value upload_max_filesize 200M
Hello InsiteFX, and thx for your answer

I have asked my ISP and he ensured me I could change that in a new php.ini file

on local (easyphp) your changes work fine(!!) on the prod server they crash (error 500) and
on local, the php.ini doesn't work, but returns no error, on prod serv it gives the error in my above post
Reply
#5

On a local system the php.ini is in the php folder / directory.

Try putting it in the root of your project or public folder where index.php is.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(This post was last modified: 03-11-2017, 02:46 AM by GBNet.)

Yes, I ve done it, it returns all that errors when in the same folder than the index (and I don't really understand why) :

******Edition : I don't have access to "the" php.ini, I am just talking about a custom one with 2 or 3 lines****

A PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 118

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /homepages/23/d572140987/htdocs/myxxx/system/core/Exceptions.php:272)

Filename: core/Common.php

Line Number: 568

Backtrace:

An uncaught Exception was encountered

Type: Exception

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.

Filename: /homepages/23/d572140987/htdocs/myxxx/system/libraries/Session/drivers/Session_files_driver.php

Line Number: 120

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once
Reply
#7

If you changed the directory structure of CodeIgniter you will need to tell index.php where the application and system directories are located.

On a live server the php.ini file should be placed in the your public or public_html folder were index.php is.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#8

I am not really sure of what you mean by "changed the dir structure", I think I didn't touch a lot in this ; I have just removed the index.php off the urls, and modified the route.cfg accordingly (with multi-languages scheme too), but elsewhere it works fine.

And yes, the errors appear when I put the php.ini in this same folder as index.php, when I put it in the controllers or in the views, no error, but no effect -)
Reply
#9

If you have moved the application or system folders then you need to change the paths in index.php
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#10

(03-08-2017, 02:24 AM)GBNet Wrote: A PHP Error was encountered

Severity: Warning

Message: mkdir(): Invalid path

Filename: drivers/Session_files_driver.php

Line Number: 118

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /homepages/23/d572140987/htdocs/myxxx/system/core/Exceptions.php:272)

Filename: core/Common.php

Line Number: 568

Backtrace:

An uncaught Exception was encountered

Type: Exception

Message: Session: Configured save path '' is not a directory, doesn't exist or cannot be created.

Filename: /homepages/23/d572140987/htdocs/myxxx/system/libraries/Session/drivers/Session_files_driver.php

Line Number: 120

Backtrace:

File: /homepages/23/d572140987/htdocs/myxxx/application/core/MY_Controller.php
Line: 173
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/application/controllers/Index.php
Line: 8
Function: __construct

File: /homepages/23/d572140987/htdocs/myxxx/index.php
Line: 316
Function: require_once



Provide an absolute path in application/config/config.php file

$config['sess_save_path'] = NULL; e.g. replace NULL with APPPATH.'sess/';//sess folder must be present
Reply




Theme © iAndrew 2016 - Forum software by © MyBB