Today I was upgrading this site to the latest Modx version 2.2.7. After uploading all files and navigating browser to setup directory I was surprised by error message:
Warning: session_start() [function.session-start]: SAFE MODE Restriction in effect. The script whose uid is 603 is not allowed to access /tmp owned by uid 0 in /home/.../public_html/setup/index.php on line 32
Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: files (path: ) in /home/.../public_html/setup/index.php on line 32
PHP Safe Mode is deprecated as of PHP 5.3.0. but many ISP still use it for now. Solution is turning off save mode during Modx upgrade using custom PHP ini settings.
Luckily my web hosting provider, netregistry.com.au allows custom PHP configuration using php.ini file located in document root directory. This cannot be set in .htaccess file. Adding two lines solved the isue:
safe_mode = 0
safe_mode_gid = 1
But that was not the end of troubles - I got another error from setup script:
FATAL ERROR: MODX Setup cannot continue. To use PHP 5.3.0+, you must set the date.timezone setting in your php.ini. Please do set it to a proper timezone before proceeding. A list can be found here.
Solution was to add another line to php.ini file: date.timezone = Australia/Sydney
Here is my final custom php.ini file used on netregistry hosting. Besides option to turn off safe mode and setting time zone it sets memory limit, maximum uploaded file and maximum execution time for php script. Plus explicitly enables PDO php extensions because after uploding php.ini file on server I got PDO error as if it was not enabled.
; custom php configuration on netregistry.com.au hosting ; ; to make this php.ini global for your hosting account ; add to .htaccess this line: suPHP_ConfigPath /home/.../public_html/ ; turn off safe mode during Modx upgrade - uncomment following 2 lines ;safe_mode = 0 ;safe_mode_gid = 1 ; set time zone date.timezone = Australia/Sydney ; enable PDO extensions extension="pdo.so" extension="pdo_mysql.so" ; adjust max limits memory_limit = 256M post_max_size = 20M upload_max_filesize = 20M max_execution_time = 60