Jump to content

[SOLVED] problems when using a local php.ini in the dmain root


bbunlock

Recommended Posts

I have a ringtone creator site where people can upload music files and select sections to make into a ringtone, I have for the last year been using a cgi upload script becuase it can handle 32M out of the box where php can only handle 2M

 

now I have changed the cgi upload to a flash upload but have had problems with it, the flash app usues php to move the upload file to the folder I want to store the uploaded files in so im kinda back to sqaure one with the 2mb limit.

 

I could change the php.ini/httpd.conf file(s) to change the 2M limit but this is a shared server so didnt want to go that route so decided to try and change the limit via .htaccess but that didnt work, php is a cgi module not a apache module so php_value in htaccess has no effect when in cgi mode.

 

I have tried adding a php.ini with the following params to the doomains root and that works great for uploading the files.

 

max_execution_time = 60
max_input_time = 120
memory_limit = 128M
post_max_size = 12M
upload_max_filesize = 10M

 

however even though that allows me to upload large files upto 12M it actualy breaks the flash application that loads and plays the uploaded mp3, for example I upload test.mp3 of 5M and it uploads perfectly to the server (with the php.ini listed above) but the flash app will not play the mp3 file? if I delete the php.ini from the root and refresh the page it works great?

 

so basicaly the php.ini allows me to upload large files but breaks the flash app, but without the php.ini it wont upload files over 2mb, well thats not true it actualy uploads the file no problem but the flash ap then calls upload.php to move it from the servers default tmp folder to the folder where the files are stored for the flash editor and then tells me in my error_log the file was over 2M and was not saved.

 

Now I have used .htaccess lots of times for mod rewite etc but this is the first time I have used a php.ini instead of a htaccess file, so is there somthing I need to add to my php.ini file to solve this? please be aware that the code I listed above as to what is in my php.ini file is exactly whats in it, there are no other lines of code in the file just the 5 lines listed above.

 

hope someone can shed some light on this for me

 

regards

 

wayne

 

Link to comment
Share on other sites

You would need to determine what exactly is wrong that is causing "the flash app will not play the mp3 file." Is the file corrupt, is the link invalid? Can your play the file using a different method?

 

Web servers just serve files. If the file was successfully uploaded, find out why it is not being served correctly.

 

Without the php.ini, what does a phpinfo() statement show for all of those settings? For all we know some of the existing values are higher than those settings and putting them to a lower value is preventing the file from being output correctly, assuming you are dynamically outputting it using a php script.

 

Beyond these things, you would need to provide more information about the problem and about what the code is.

Link to comment
Share on other sites

Hi PFMaBiSmAd thanks for the reply

 

first I have to say there is nothing wrong with the flash app if there is no php.ini in the domain root, here is an example of what happens with large files

 

1, add the php.ini to the domain root with the values listed above

 

2, upload an mp3 (example 5M)

 

3, upload completes and now transfered to the flash app for editing

 

4, press play and nothing is heard (doesnt play the uploaded mp3)

 

5, now I goto the domain root and delete the php.ini file

 

6, go back to web page and refresh the the page loading the flash app again

 

7, press play and all works fine with no php.ini

 

I did my normal thing and tried to narrow down the problem with the php.ini by removing a line at a time and see if the ap works, the strange thing is that it doesnt matter whats in the php.ini, for example I uploaded an empty php.ini (0 bytes) and it didnt play the file, so basicaly any php.ini file with content or empty prevents the flash app from playing the mp3.

 

Now my guess would be that the php.ini may need other param in it to work correctly? as I mentioned above it only has those 5 lines in it so I dont know if php.ini needs any special open/close params for it to work correctly, as in a .htaccess file the params above would be

 


<IfModule mod_php4.c>
php_value max_execution_time 60
php_value max_input_time 120
php_value memory_limit 128M
php_value post_max_size 14M
php_value upload_max_filesize 10M
</IfModule>

 

which means you need the <IfModule mod_phpxxx> for it to work in htaccess, is there somthing that php.ini needs for it to work correctly?

 

regards

 

wayne

Link to comment
Share on other sites

Normally a local php.ini only overrides the settings that are in it and uses the master php.ini settings for everything else. I'm going to guess that your server is configured to use only the settings in a local php.ini when it is present, which would mean that any setting that you don't have in your local php.ini are off/0/false/default.

 

Do a phpinfo() statement for both cases, with and without a local php.ini and see what differences there are.

Link to comment
Share on other sites

thanks PFMaBiSmAd you cracked it :-)

 

I had looked at the phpinfo data hours ago to see if the changes in the local php.ini had been made and they were, I never thought to look and see if other things had changed, I added a few lines more to the local php.ini file that were different with and without the php.ini and now all works great :-)

 

not sure if ringtones are your thing but you might like to see it in action, http://www.ringbuz.com totaly free to use so dont panic you wont need to register or anything

 

once again PFMaBiSmAd thanks for the help on this

 

regards

 

wayne

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.